diff --git a/README.md b/README.md index c1b895f..fabe6b8 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ with the following content: from rq import Queue, Worker q = Queue() - Worker(q).work_forever() + Worker(q).work() After that, start a worker instance: @@ -66,12 +66,12 @@ them: from rq import Queue, Worker queues = map(Queue, ['high', 'normal', 'low']) - Worker(queues).work() + Worker(queues).work_burst() Which will keep popping jobs from the given queues, giving precedence to the `high` queue, then `normal`, etc. It will return when there are no more jobs -left (contrast this to the previous example using `Worker.work_forever()`, -which will never return since it keeps waiting for new work to arrive). +left (contrast this to the previous example using `Worker.work()`, which will +never return since it keeps waiting for new work to arrive). # Installation diff --git a/examples/run_worker.py b/examples/run_worker.py index e87ec89..4853788 100644 --- a/examples/run_worker.py +++ b/examples/run_worker.py @@ -7,4 +7,4 @@ conn.push(Redis()) if __name__ == '__main__': q = Queue() - Worker(q).work_forever() + Worker(q).work() diff --git a/rq/worker.py b/rq/worker.py index e1bd1a7..c2ccef3 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -68,10 +68,10 @@ class Worker(object): self.fork_and_perform_job(job) return did_work - def work_forever(self): + def work(self): self._work(False) - def work(self): + def work_burst(self): return self._work(True) def fork_and_perform_job(self, job): diff --git a/tests/test_rq.py b/tests/test_rq.py index 1701537..91d7926 100644 --- a/tests/test_rq.py +++ b/tests/test_rq.py @@ -143,10 +143,10 @@ class TestWorker(RQTestCase): """Worker processes work, then quits.""" fooq, barq = Queue('foo'), Queue('bar') w = Worker([fooq, barq]) - self.assertEquals(w.work(), False, 'Did not expect any work on the queue.') + self.assertEquals(w.work_burst(), False, 'Did not expect any work on the queue.') fooq.enqueue(testjob, name='Frank') - self.assertEquals(w.work(), True, 'Expected at least some work done.') + self.assertEquals(w.work_burst(), True, 'Expected at least some work done.') if __name__ == '__main__':