Przeglądaj źródła

Chord: Never call callback more than once

Ask Solem 10 lat temu
rodzic
commit
baf0687110
2 zmienionych plików z 6 dodań i 2 usunięć
  1. 5 1
      celery/backends/base.py
  2. 1 1
      celery/backends/redis.py

+ 5 - 1
celery/backends/base.py

@@ -549,7 +549,11 @@ class KeyValueStoreBackend(BaseBackend):
                     ChordError('GroupResult {0} no longer exists'.format(gid)),
                 )
         val = self.incr(key)
-        if val >= len(deps):
+        size = len(deps)
+        if val > size:
+            logger.warning('Chord counter incremented too many times for %r',
+                           gid)
+        elif val == size:
             callback = maybe_signature(task.request.chord, app=app)
             j = deps.join_native if deps.supports_native_join else deps.join
             try:

+ 1 - 1
celery/backends/redis.py

@@ -219,7 +219,7 @@ class RedisBackend(KeyValueStoreBackend):
         try:
             callback = maybe_signature(request.chord, app=app)
             total = callback['chord_size'] + totaldiff
-            if readycount >= total:
+            if readycount == total:
                 decode, unpack = self.decode, self._unpack_chord_result
                 resl, _, _ = client.pipeline()  \
                     .lrange(jkey, 0, total)     \