diff options
author | Roberto De Ioris <info@unbit.it> | 2015-05-06 09:11:35 +0200 |
---|---|---|
committer | Roberto De Ioris <info@unbit.it> | 2015-05-06 09:11:35 +0200 |
commit | 84374ba4f99e74d6c8bfdc67a257e7dc64e27b52 (patch) | |
tree | e6eba221992d113a9d9ba068995e5c49fb212e99 /t | |
parent | a358816dc75b8132b7c79037646393be7102a53d (diff) | |
download | uwsgi-84374ba4f99e74d6c8bfdc67a257e7dc64e27b52.tar.gz |
implementation of #904
Diffstat (limited to 't')
-rw-r--r-- | t/spooler/cheap.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/t/spooler/cheap.py b/t/spooler/cheap.py new file mode 100644 index 00000000..1ea585ea --- /dev/null +++ b/t/spooler/cheap.py @@ -0,0 +1,21 @@ +# uwsgi --spooler spool1 --spooler spool2 --spooler-cheap --spooler-frequency 5 --spooler-processes 4 --mule --shared-py-import=t/spooler/cheap.py --stats :5000 +from uwsgidecorators import * +import time +import random +import os + +def fake(args): + time.sleep(6) + return uwsgi.SPOOL_OK + +uwsgi.spooler = fake + +base = os.getcwd() +spoolers = [base + '/spool1', base + '/spool2'] + +@mule(1) +def spooler_enqueuer(): + while True: + print("enqueuing task...") + uwsgi.spool({'one':'two', 'spooler': random.choice(spoolers)}) + time.sleep(random.randrange(1, 15)) |