Permalink
Browse files

Correct full queue

  • Loading branch information...
1 parent 5244eb9 commit b9c69f253b82dfe752dfd9358809c66c6ba38548 @dcramer committed May 15, 2012
Showing with 9 additions and 4 deletions.
  1. +1 −1 setup.py
  2. +7 −2 src/taskmaster/cli/master.py
  3. +1 −1 src/taskmaster/example.py
View
@@ -5,7 +5,7 @@
setup(
name="taskmaster",
license='Apache License 2.0',
- version="0.4.0",
+ version="0.4.1",
description="",
author="David Cramer",
author_email="dcramer@gmail.com",
@@ -7,9 +7,10 @@
"""
import cPickle as pickle
+import gevent
from gevent_zeromq import zmq
from taskmaster.controller import Controller
-from gevent.queue import Queue, Empty
+from gevent.queue import Queue, Empty, Full
class Server(object):
@@ -47,7 +48,11 @@ def start(self):
self.shutdown()
def put_job(self, job):
- self.queue.put_nowait(job)
+ while True:
+ try:
+ return self.queue.put_nowait(job)
+ except Full:
+ gevent.sleep(0)
def first_job(self):
return self.queue.queue[0]
@@ -10,7 +10,7 @@
def get_jobs(last=0):
# last_job would be sent if state was resumed
# from a previous run
- for i in xrange(last, 10000):
+ for i in xrange(last, 20000):
yield i

0 comments on commit b9c69f2

Please sign in to comment.