Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add info to readme for running on top of flask-socketio #3

Closed
piejanssens opened this issue Jul 17, 2015 · 2 comments
Closed

Add info to readme for running on top of flask-socketio #3

piejanssens opened this issue Jul 17, 2015 · 2 comments

Comments

@piejanssens
Copy link

I had weird results. Scheduling with a 5s interval resulted in this:

1437117604.32 :calling update() thread: MainProcess - Thread-10 
1437117605.6 :calling update() thread: MainProcess - Thread-14 
1437117609.35 :calling update() thread: MainProcess - Thread-10 
1437117610.62 :calling update() thread: MainProcess - Thread-14 
1437117614.32 :calling update() thread: MainProcess - Thread-13 
1437117615.61 :calling update() thread: MainProcess - Thread-17 
1437117619.32 :calling update() thread: MainProcess - Thread-10 

Solution is to use the monkey patch from gevent by putting this above all other imports in your app.py:

from gevent import monkey
monkey.patch_all()
@viniciuschiele
Copy link
Owner

@piejanssens

Have you tried GeventScheduler? It might solve your issue too.

The following code is just a guess, I have not tried running it.

from apscheduler.schedulers.gevent import GeventScheduler
from flask_apscheduler import APScheduler

sched = APScheduler(GeventScheduler())

Cheers!

@piejanssens
Copy link
Author

That's even better! The monkey patch caused this ugly thing: http://stackoverflow.com/questions/8774958/keyerror-in-module-threading-after-a-successful-py-test-run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants