Skip to content

Commit 4a7cd24

Browse files
committed
Fix falsy values being silently dropped in client methods
raise_orchestration_event, terminate_orchestration, and signal_entity used 'if data/output/input' checks which silently convert valid falsy values (0, False, '', []) to None. Changed to 'is not None' checks to match the existing pattern in schedule_new_orchestration.
1 parent 424ffa9 commit 4a7cd24

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

durabletask/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def raise_orchestration_event(self, instance_id: str, event_name: str, *,
199199
req = pb.RaiseEventRequest(
200200
instanceId=instance_id,
201201
name=event_name,
202-
input=wrappers_pb2.StringValue(value=shared.to_json(data)) if data else None)
202+
input=wrappers_pb2.StringValue(value=shared.to_json(data)) if data is not None else None)
203203

204204
self._logger.info(f"Raising event '{event_name}' for instance '{instance_id}'.")
205205
self._stub.RaiseEvent(req)
@@ -209,7 +209,7 @@ def terminate_orchestration(self, instance_id: str, *,
209209
recursive: bool = True):
210210
req = pb.TerminateRequest(
211211
instanceId=instance_id,
212-
output=wrappers_pb2.StringValue(value=shared.to_json(output)) if output else None,
212+
output=wrappers_pb2.StringValue(value=shared.to_json(output)) if output is not None else None,
213213
recursive=recursive)
214214

215215
self._logger.info(f"Terminating instance '{instance_id}'.")
@@ -237,7 +237,7 @@ def signal_entity(self,
237237
req = pb.SignalEntityRequest(
238238
instanceId=str(entity_instance_id),
239239
name=operation_name,
240-
input=wrappers_pb2.StringValue(value=shared.to_json(input)) if input else None,
240+
input=wrappers_pb2.StringValue(value=shared.to_json(input)) if input is not None else None,
241241
requestId=str(uuid.uuid4()),
242242
scheduledTime=None,
243243
parentTraceContext=None,

0 commit comments

Comments
 (0)