diff --git a/celery/backends/base.py b/celery/backends/base.py index 28e5b2a4d6b..74fce23c3c4 100644 --- a/celery/backends/base.py +++ b/celery/backends/base.py @@ -919,7 +919,11 @@ def on_chord_part_return(self, request, state, result, **kwargs): ChordError(f'GroupResult {gid} no longer exists'), ) val = self.incr(key) - size = len(deps) + # Set the chord size to the value defined in the request, or fall back + # to the number of dependencies we can see from the restored result + size = request.chord.get("chord_size") + if size is None: + size = len(deps) if val > size: # pragma: no cover logger.warning('Chord counter incremented too many times for %r', gid)