Skip to content

Instantly share code, notes, and snippets.

View vgavro's full-sized avatar

Victor Gavro vgavro

View GitHub Profile
@vgavro
vgavro / check_concurrency.py
Created January 14, 2018 13:00
Gevent check concurrency
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)