-
-
Notifications
You must be signed in to change notification settings - Fork 782
Don't call eventlet directly inside the st2reactor code #4792
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
Changes from all commits
d05c236
ee52f63
b1360e6
e8e8e49
1b343ee
6478e3d
b5780b8
cebeccc
c601c19
2bb212b
0568f19
fba4935
dc178a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,7 +41,9 @@ | |
| 'spawn', | ||
| 'wait', | ||
| 'cancel', | ||
| 'kill' | ||
| 'kill', | ||
| 'sleep', | ||
| 'get_greenlet_exit_exception_class' | ||
| ] | ||
|
|
||
|
|
||
|
|
@@ -111,3 +113,21 @@ def kill(green_thread, *args, **kwargs): | |
| return green_thread.kill(*args, **kwargs) | ||
| else: | ||
| raise ValueError('Unsupported concurrency library') | ||
|
|
||
|
|
||
| def sleep(*args, **kwargs): | ||
| if CONCURRENCY_LIBRARY == 'eventlet': | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like there should be a better way to handle the eventlet vs. gevent driver than to use all these if/else across different methods in this module.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we get much with doing it differently. We could abstract it some more, in some driver / plugin approach but that would be massive amount of work for very little value. |
||
| return eventlet.sleep(*args, **kwargs) | ||
| elif CONCURRENCY_LIBRARY == 'gevent': | ||
| return gevent.sleep(*args, **kwargs) | ||
| else: | ||
| raise ValueError('Unsupported concurrency library') | ||
|
|
||
|
|
||
| def get_greenlet_exit_exception_class(): | ||
| if CONCURRENCY_LIBRARY == 'eventlet': | ||
| return eventlet.support.greenlets.GreenletExit | ||
| elif CONCURRENCY_LIBRARY == 'gevent': | ||
| return gevent.GreenletExit | ||
| else: | ||
| raise ValueError('Unsupported concurrency library') | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do these pip related changes have to do with the changes to not directly call eventlet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally I would open separate PR for each of those set of changes, but I kinda wanted to avoid that.