Reschedules the current thread to allow other waiting threads to proceed. When carrying out longer-running operations e.g. in a while loop, the Python process is blocked by default. That means that all other threads are frozen. This problem can be avoided by frequently calling this meth
(seconds=0)
| 2 | |
| 3 | |
| 4 | def reschedule(seconds=0): |
| 5 | """Reschedules the current thread to allow other waiting threads to proceed. |
| 6 | |
| 7 | When carrying out longer-running operations e.g. in a while loop, the Python |
| 8 | process is blocked by default. That means that all other threads are frozen. |
| 9 | This problem can be avoided by frequently calling this method in the loop at |
| 10 | a (most likely) negligible performance penalty. |
| 11 | |
| 12 | Args: |
| 13 | seconds: An integer or a float of the number of seconds to yield for. |
| 14 | """ |
| 15 | # Flask uses eventlet internally. Calling `time.sleep` wouldn’t help here, |
| 16 | # since we don’t (and don’t want to) monkey-patch Python’s time API. |
| 17 | eventlet.sleep(seconds) |
nothing calls this directly
no outgoing calls
no test coverage detected