when a timer fires, it should also schedule a decision (#4791)
This commit is contained in:
parent
5e9c238fcc
commit
d5fcc31763
@ -726,6 +726,7 @@ class WorkflowExecution(BaseModel):
|
|||||||
"TimerFired", started_event_id=started_event_id, timer_id=timer_id
|
"TimerFired", started_event_id=started_event_id, timer_id=timer_id
|
||||||
)
|
)
|
||||||
self._timers.pop(timer_id)
|
self._timers.pop(timer_id)
|
||||||
|
self._schedule_decision_task()
|
||||||
|
|
||||||
def cancel_timer(self, event_id, timer_id):
|
def cancel_timer(self, event_id, timer_id):
|
||||||
requested_timer = self._timers.get(timer_id)
|
requested_timer = self._timers.get(timer_id)
|
||||||
|
@ -589,10 +589,12 @@ def test_start_timer_correctly_fires_timer_later():
|
|||||||
# Small wait to let both events populate
|
# Small wait to let both events populate
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
|
|
||||||
|
second_to_last_event = wfe.events()[-2]
|
||||||
last_event = wfe.events()[-1]
|
last_event = wfe.events()[-1]
|
||||||
last_event.event_type.should.equal("TimerFired")
|
second_to_last_event.event_type.should.equal("TimerFired")
|
||||||
last_event.event_attributes["timerId"].should.equal("abc123")
|
second_to_last_event.event_attributes["timerId"].should.equal("abc123")
|
||||||
last_event.event_attributes["startedEventId"].should.equal(1)
|
second_to_last_event.event_attributes["startedEventId"].should.equal(1)
|
||||||
|
last_event.event_type.should.equal("DecisionTaskScheduled")
|
||||||
|
|
||||||
|
|
||||||
def test_start_timer_fails_if_timer_already_started():
|
def test_start_timer_fails_if_timer_already_started():
|
||||||
|
@ -505,16 +505,17 @@ def test_start_and_fire_timer_decision():
|
|||||||
"DecisionTaskCompleted",
|
"DecisionTaskCompleted",
|
||||||
"TimerStarted",
|
"TimerStarted",
|
||||||
"TimerFired",
|
"TimerFired",
|
||||||
|
"DecisionTaskScheduled",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
resp["events"][-2]["timerStartedEventAttributes"].should.equal(
|
resp["events"][-3]["timerStartedEventAttributes"].should.equal(
|
||||||
{
|
{
|
||||||
"decisionTaskCompletedEventId": 4,
|
"decisionTaskCompletedEventId": 4,
|
||||||
"startToFireTimeout": "1",
|
"startToFireTimeout": "1",
|
||||||
"timerId": "timer1",
|
"timerId": "timer1",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
resp["events"][-1]["timerFiredEventAttributes"].should.equal(
|
resp["events"][-2]["timerFiredEventAttributes"].should.equal(
|
||||||
{"startedEventId": 5, "timerId": "timer1"}
|
{"startedEventId": 5, "timerId": "timer1"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user