diff options
author | Ask Solem <ask@celeryproject.org> | 2016-09-02 15:35:39 -0700 |
---|---|---|
committer | Ask Solem <ask@celeryproject.org> | 2016-09-02 15:39:45 -0700 |
commit | 84fc45b9a76026c054ab1d31ec3883dd2e56c440 (patch) | |
tree | ba4f0b2b09670ef505470b97b155a61e5b5e2867 /kombu/utils | |
parent | f71ea5c803a29706afd195ef570607838dc53519 (diff) | |
download | kombu-84fc45b9a76026c054ab1d31ec3883dd2e56c440.tar.gz |
Virtual transport deliver now calls callback, no return value. Fixes #593
Diffstat (limited to 'kombu/utils')
-rw-r--r-- | kombu/utils/scheduling.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kombu/utils/scheduling.py b/kombu/utils/scheduling.py index f44222db..e5833fa1 100644 --- a/kombu/utils/scheduling.py +++ b/kombu/utils/scheduling.py @@ -40,15 +40,19 @@ class FairCycle(object): if not self.resources: raise self.predicate() - def get(self, **kwargs): + def get(self, callback, **kwargs): + succeeded = 0 for tried in count(0): # for infinity resource = self._next() - try: - return self.fun(resource, **kwargs), resource + return self.fun(resource, callback, **kwargs) except self.predicate: if tried >= len(self.resources) - 1: - raise + if not succeeded: + raise + break + else: + succeeded += 1 def close(self): pass |