From 946c7b1783f9c594c685cb9680102c015ff54552 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 10 Sep 2024 19:53:14 +0200 Subject: [PATCH] [procedure] Ignore `id` field in `Procedure.build`. The reason is that an `id` specified on procedure level will be applied to all the child requests. This means that the first response from the first completed request will be sent to Redis and mistakenly interpreted by HTTP listeners as the return value of the whole procedure. `Procedure.build` should instead calculate its own ID for the procedure, and apply different IDs to the child requests. --- platypush/procedure/__init__.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/platypush/procedure/__init__.py b/platypush/procedure/__init__.py index 56cdc8f130..50ac5bb49c 100644 --- a/platypush/procedure/__init__.py +++ b/platypush/procedure/__init__.py @@ -55,7 +55,6 @@ class Procedure: requests, args=None, backend=None, - id=None, # pylint: disable=redefined-builtin procedure_class=None, **kwargs, ): @@ -66,6 +65,7 @@ class Procedure: if_config = LifoQueue() procedure_class = procedure_class or cls key = None + kwargs.pop('id', None) for request_config in requests: # Check if it's a break/continue/return statement @@ -91,7 +91,6 @@ class Procedure: 'condition': condition, 'else_branch': [], 'backend': backend, - 'id': id, } ) @@ -132,7 +131,6 @@ class Procedure: _async=_async, requests=request_config[key], backend=backend, - id=id, iterator_name=iterator_name, iterable=iterable, ) @@ -156,14 +154,12 @@ class Procedure: requests=request_config[key], condition=condition, backend=backend, - id=id, ) reqs.append(loop) continue request_config['origin'] = Config.get('device_id') - request_config['id'] = id if 'target' not in request_config: request_config['target'] = request_config['origin']