Skip to content

Commit

Permalink
add py FIFO thread pool
Browse files Browse the repository at this point in the history
  • Loading branch information
kentslaney committed Jan 27, 2024
1 parent ad0bd7a commit 37eb65c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions misc/runbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def reserve(self):
mc = self.clients.get(False)
self.semaphore.put(1)
except:
channel = Queue()
channel = Queue(1)
self.waiting.put(channel)
self.semaphore.put(1)
channel.get()
Expand All @@ -349,9 +349,9 @@ def reserve(self):
try:
yield mc
finally:
self.semaphore.get()
self.clients.put(mc)
try:
self.semaphore.get()
self.waiting.get(False).put(1)
except:
self.semaphore.put(1)
Expand Down Expand Up @@ -412,7 +412,7 @@ def reserve(self):
threads=NTHREADS
),
Participant(
# name='libmc(md5 / ketama / nodelay / nonblocking / py thread pool, from douban)',
# name='libmc(md5 / ketama / nodelay / nonblocking / py FIFO thread pool, from douban)',
name='libmc (py FIFO thread pool)',
factory=lambda: Prefix(FIFOThreadPool(**libmc_kwargs), 'libmc5'),
threads=NTHREADS
Expand Down Expand Up @@ -471,7 +471,6 @@ def loop(sw):
logger.info(u'%76s: %s', participant.name, total)
exceptions[i].append(None)
except Exception as e:
raise
logger.info(u'%76s: %s', participant.name, "failed")
exceptions[i].append(e)
last_fn = fn
Expand Down

0 comments on commit 37eb65c

Please sign in to comment.