summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorKrzysztof A. Adamski <krzysztofa@gmail.com>2008-06-06 18:08:26 -0400
committerKrzysztof A. Adamski <krzysztofa@gmail.com>2008-06-06 18:08:26 -0400
commit3f62e1d302fb63f1f3c5c72121388c8b0dd6e784 (patch)
treec7f1dbcc4c68a7c56ae8ea9e8d9705dba8d2df0e /func
parent8e96ee4101213ccaba11c95729bf88171873d03c (diff)
downloadthird_party-func-3f62e1d302fb63f1f3c5c72121388c8b0dd6e784.tar.gz
third_party-func-3f62e1d302fb63f1f3c5c72121388c8b0dd6e784.tar.xz
third_party-func-3f62e1d302fb63f1f3c5c72121388c8b0dd6e784.zip
Fixing "modulus voodoo".
Diffstat (limited to 'func')
-rw-r--r--func/forkbomb.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/func/forkbomb.py b/func/forkbomb.py
index b835d3d..7cc9df3 100644
--- a/func/forkbomb.py
+++ b/func/forkbomb.py
@@ -75,8 +75,8 @@ def __bucketize(pool, slots):
buckets = {}
count = 0
for key in pool:
- count = count + 1
slot = count % slots
+ count = count + 1
if not buckets.has_key(slot):
buckets[slot] = []
buckets[slot].append(key)
@@ -130,9 +130,9 @@ def batch_run(pool,callback,nforks=DEFAULT_FORKS,cachedir=DEFAULT_CACHE_DIR):
the workload over nfork forks. Temporary files used during the
operation will be created in cachedir and subsequently deleted.
"""
- if nforks <= 1:
+ if nforks < 1:
# modulus voodoo gets crazy otherwise and bad things happen
- nforks = 2
+ nforks = 1
shelf_file = __get_storage(cachedir)
__access_buckets(shelf_file,True,None)
buckets = __bucketize(pool, nforks)