This file contains hidden or 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
def check_concurrency(sleep='time.sleep', callback=None): | |
if isinstance(sleep, str): | |
module = __import__(''.join(sleep.split('.')[:-1])) | |
sleep = getattr(module, sleep.split('.')[-1]) | |
callback = callback or (lambda x: print('concurrency={}'.format(x))) | |
check_concurrency._flag = False | |
def _set_concurrency(): | |
sleep(0.01) |