-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use gevent for celery worker, update timeout to GeventTimeout (#1345)
* hotfix for worker starting up * Use gevent for celery worker, update timeout to GeventTimeout * Use gevent for celery worker, update timeout to GeventTimeout * Default back to multiprocess worker, but with Timeout dynamic for gevent and non-gevent cases
- Loading branch information
Showing
8 changed files
with
86 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
"""This file is for dev server only. | ||
DO NOT USE FOR PROD | ||
""" | ||
|
||
from gevent import monkey | ||
|
||
monkey.patch_all() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import time | ||
|
||
import pytest | ||
|
||
from lib.utils.utils import GeventTimeout, SignalTimeout, TimeoutError | ||
|
||
|
||
def test_gevent_timeout(): | ||
with pytest.raises(TimeoutError): | ||
with GeventTimeout(0.1): | ||
time.sleep(0.2) | ||
|
||
|
||
def test_gevent_no_timeout(): | ||
try: | ||
with GeventTimeout(0.2): | ||
time.sleep(0.1) | ||
except TimeoutError: | ||
pytest.fail("TimeoutError raised when it shouldn't") | ||
|
||
|
||
def test_signal_timeout(): | ||
with pytest.raises(TimeoutError): | ||
with SignalTimeout(0.1): | ||
time.sleep(0.2) | ||
|
||
|
||
def test_signal_no_timeout(): | ||
try: | ||
with SignalTimeout(0.2): | ||
time.sleep(0.1) | ||
except TimeoutError: | ||
pytest.fail("TimeoutError raised when it shouldn't") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters