Comments (7)
Can you provide a backtrace please?
from podio-rb.
Hi Andreas
We found the reason of the problem, and why it worked in testing but not in production. We are doing the API setup in a initializers/podio.rb file, with
Podio.setup(:api_key => 'YOUR_API_KEY', :api_secret => 'YOUR_API_SECRET')
Podio.client.authenticate_with_credentials('YOUR_PODIO_ACCOUNT', 'YOUR_PODIO_PASSWORD')
Now, the problem is that in production we use Passenger (with Apache), and we discovered that the setup is only done once when starting the server - not once for every process that Passenger spawns. And your client is somehow tied to the process itself, so, inside each passenger processes, Podio.client is actually nil
We did a quick fix by adding a before_filter to ApplicationController, and init the api if Podio.client.nil? , but this is very ugly. If you are aware of - or can find - any better solution to init the API only once, in a way that works with Passenger (which I think is used by 99% of Rails developers), that would be very useful :)
from podio-rb.
The gem uses thread local storage to store the current connection, which I think is causing what you're experiencing. This is mentioned briefly in the readme, but should probably be more explicit. We'll try think of a better solution -- thanks for bringing up the issue!
from podio-rb.
Ok, please update us if you find one!
from podio-rb.
Just ran into this issue as well. Thanks for the workaround @danmaz74
from podio-rb.
Having the same issue when calling Podio in Sidekiq job. What's the best way to initialise library when using Sidekiq?
from podio-rb.
I haven't personally used Sidekiq but I did a quick scan of the docs. There is a mention that workers must be thread safe. It appears that you'd have to initialize a connection to the Podio Api within each worker.
from podio-rb.
Related Issues (20)
- Rails 4 support HOT 4
- getting bitten by uninitialized constant ActiveSupport::Autoload HOT 2
- faraday 0.9.0? HOT 2
- saving items with calculation fields returns an error HOT 3
- ItemDiff.revert used inside hook causes infinite loop HOT 2
- Ruby 2.1 & 2.2, Getting: Faraday::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed HOT 2
- error on adding podio gem to project HOT 2
- Versioning and Tagging? HOT 6
- NoMethodError (undefined method `[]' for nil:NilClass)
- Using this gem in a multi-user system HOT 1
- Rate limit information HOT 3
- External id not returned by "Get item revision difference" HOT 9
- Podio API & gem still alive? HOT 1
- Why thread locals? HOT 12
- "Active Podio" & custom attributes HOT 5
- Outdated Faraday dependency HOT 6
- Typo, please delete
- Faraday dependency making this gem tough for new apps
- Documentation inconsistencies regarding Content-Type for authenticate_with_app
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from podio-rb.