forked from platypush/platypush
[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.
This commit is contained in:
parent
5a7068501a
commit
946c7b1783
1 changed files with 1 additions and 5 deletions
|
@ -55,7 +55,6 @@ class Procedure:
|
||||||
requests,
|
requests,
|
||||||
args=None,
|
args=None,
|
||||||
backend=None,
|
backend=None,
|
||||||
id=None, # pylint: disable=redefined-builtin
|
|
||||||
procedure_class=None,
|
procedure_class=None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
|
@ -66,6 +65,7 @@ class Procedure:
|
||||||
if_config = LifoQueue()
|
if_config = LifoQueue()
|
||||||
procedure_class = procedure_class or cls
|
procedure_class = procedure_class or cls
|
||||||
key = None
|
key = None
|
||||||
|
kwargs.pop('id', None)
|
||||||
|
|
||||||
for request_config in requests:
|
for request_config in requests:
|
||||||
# Check if it's a break/continue/return statement
|
# Check if it's a break/continue/return statement
|
||||||
|
@ -91,7 +91,6 @@ class Procedure:
|
||||||
'condition': condition,
|
'condition': condition,
|
||||||
'else_branch': [],
|
'else_branch': [],
|
||||||
'backend': backend,
|
'backend': backend,
|
||||||
'id': id,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -132,7 +131,6 @@ class Procedure:
|
||||||
_async=_async,
|
_async=_async,
|
||||||
requests=request_config[key],
|
requests=request_config[key],
|
||||||
backend=backend,
|
backend=backend,
|
||||||
id=id,
|
|
||||||
iterator_name=iterator_name,
|
iterator_name=iterator_name,
|
||||||
iterable=iterable,
|
iterable=iterable,
|
||||||
)
|
)
|
||||||
|
@ -156,14 +154,12 @@ class Procedure:
|
||||||
requests=request_config[key],
|
requests=request_config[key],
|
||||||
condition=condition,
|
condition=condition,
|
||||||
backend=backend,
|
backend=backend,
|
||||||
id=id,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
reqs.append(loop)
|
reqs.append(loop)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
request_config['origin'] = Config.get('device_id')
|
request_config['origin'] = Config.get('device_id')
|
||||||
request_config['id'] = id
|
|
||||||
if 'target' not in request_config:
|
if 'target' not in request_config:
|
||||||
request_config['target'] = request_config['origin']
|
request_config['target'] = request_config['origin']
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue