incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject git commit: [#5552] use explicit StopIteration to exit out of monq.get()
Date Tue, 08 Jan 2013 22:22:46 GMT
Updated Branches:
  refs/heads/master 39951f802 -> 57aa6253e


[#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/57aa6253
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/57aa6253
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/57aa6253

Branch: refs/heads/master
Commit: 57aa6253e04940d3c600596ada103ef0d931cab0
Parents: 39951f8
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Mon Jan 7 22:54:48 2013 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Tue Jan 8 22:22:24 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/57aa6253/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/57aa6253/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):


Mime
View raw message