Skip to content

Commit d2786e0

Browse files
authored
Increase sequence number in fire-and-forget APIs and fix ContinueAsNew Serialization (#312)
1 parent bd26e33 commit d2786e0

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

azure/durable_functions/models/DurableOrchestrationContext.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ def _record_fire_and_forget_action(self, action: Action):
473473
else:
474474
new_action = [action]
475475
self._add_to_actions(new_action)
476+
self._sequence_number += 1
476477

477478
def signal_entity(self, entityId: EntityId,
478479
operationName: str, operationInput: Optional[Any] = None):

azure/durable_functions/models/actions/ContinueAsNewAction.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from .Action import Action
44
from .ActionType import ActionType
55
from ..utils.json_utils import add_attrib
6+
from json import dumps
7+
from azure.functions._durable_functions import _serialize_custom_object
68

79

810
class ContinueAsNewAction(Action):
@@ -13,7 +15,7 @@ class ContinueAsNewAction(Action):
1315
"""
1416

1517
def __init__(self, input_=None):
16-
self.input_ = input_
18+
self.input_ = dumps(input_, default=_serialize_custom_object)
1719

1820
@property
1921
def action_type(self) -> int:

tests/orchestrator/test_entity.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,24 @@ def test_signal_entity_sent():
196196
#assert_valid_schema(result)
197197
assert_orchestration_state_equals(expected, result)
198198

199+
def test_signal_entity_sent_and_response_received():
200+
entityId = df.EntityId("Counter", "myCounter")
201+
context_builder = ContextBuilder('test_simple_function')
202+
add_call_entity_completed_events(context_builder, "get", df.EntityId.get_scheduler_id(entityId), 3, 1)
203+
204+
205+
result = get_orchestration_state_result(
206+
context_builder, generator_function_signal_entity)
207+
208+
expected_state = base_expected_state([3])
209+
add_signal_entity_action(expected_state, entityId, "add", 3)
210+
add_call_entity_action(expected_state, entityId, "get", None)
211+
expected_state._is_done = True
212+
expected = expected_state.to_json()
213+
214+
#assert_valid_schema(result)
215+
assert_orchestration_state_equals(expected, result)
216+
199217

200218
def test_call_entity_raised():
201219
entityId = df.EntityId("Counter", "myCounter")

0 commit comments

Comments
 (0)