You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/01/07 23:54:55 UTC
git commit: [#5552] use explicit StopIteration to exit out of
monq.get()
Updated Branches:
refs/heads/db/5552 [created] ed6abed9f
[#5552] use explicit StopIteration to exit out of monq.get()
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ed6abed9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ed6abed9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ed6abed9
Branch: refs/heads/db/5552
Commit: ed6abed9f29cca533866be039c0f981e29e3b106
Parents: 0b903a9
Author: Dave Brondsema <db...@geek.net>
Authored: Mon Jan 7 22:54:48 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Mon Jan 7 22:54:48 2013 +0000
----------------------------------------------------------------------
Allura/allura/command/taskd.py | 2 +-
Allura/allura/model/monq_model.py | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ed6abed9/Allura/allura/command/taskd.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/taskd.py b/Allura/allura/command/taskd.py
index d30b315..be33814 100644
--- a/Allura/allura/command/taskd.py
+++ b/Allura/allura/command/taskd.py
@@ -86,7 +86,7 @@ class TaskdCommand(base.Command):
if self.keep_running:
return func()
else:
- return None
+ raise StopIteration
return waitfunc_checks_running
if pylons.g.amq_conn:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ed6abed9/Allura/allura/model/monq_model.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/monq_model.py b/Allura/allura/model/monq_model.py
index a320666..62b8fc4 100644
--- a/Allura/allura/model/monq_model.py
+++ b/Allura/allura/model/monq_model.py
@@ -155,7 +155,8 @@ class MonQTask(MappedClass):
'''Get the highest-priority, oldest, ready task and lock it to the
current process. If no task is available and waitfunc is supplied, call
the waitfunc before trying to get the task again. If waitfunc is None
- and no tasks are available, return None.
+ and no tasks are available, return None. If waitfunc raises a
+ StopIteration, stop waiting for a task
'''
sort = [
('priority', ming.DESCENDING),
@@ -180,7 +181,10 @@ class MonQTask(MappedClass):
raise
if waitfunc is None:
return None
- waitfunc()
+ try:
+ waitfunc()
+ except StopIteration:
+ return None
@classmethod
def timeout_tasks(cls, older_than):