Skip to content

Commit c957019

Browse files
authored
Fix bug with long timers in DTS/MSSQL (#559)
* Fix bug with long timers in DTS/MSSQL
1 parent 6c7bc55 commit c957019

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

azure/durable_functions/models/DurableOrchestrationContext.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -600,22 +600,15 @@ def create_timer(self, fire_at: datetime.datetime) -> TaskBase:
600600
TaskBase
601601
A Durable Timer Task that schedules the timer to wake up the activity
602602
"""
603-
if self._replay_schema.value >= ReplaySchema.V3.value:
604-
if not self._maximum_short_timer_duration or not self._long_timer_interval_duration:
605-
raise Exception(
606-
"A framework-internal error was detected: "
607-
"replay schema version >= V3 is being used, "
608-
"but one or more of the properties `maximumShortTimerDuration`"
609-
"and `longRunningTimerIntervalDuration` are not defined. "
610-
"This is likely an issue with the Durable Functions Extension. "
611-
"Please report this bug here: "
612-
"https://github.com/Azure/azure-functions-durable-python/issues\n"
613-
f"maximumShortTimerDuration: {self._maximum_short_timer_duration}\n"
614-
f"longRunningTimerIntervalDuration: {self._long_timer_interval_duration}"
615-
)
616-
if fire_at > self.current_utc_datetime + self._maximum_short_timer_duration:
617-
action = CreateTimerAction(fire_at)
618-
return LongTimerTask(None, action, self)
603+
if (self._replay_schema.value >= ReplaySchema.V3.value
604+
and self._maximum_short_timer_duration
605+
and self._long_timer_interval_duration
606+
and fire_at > self.current_utc_datetime + self._maximum_short_timer_duration):
607+
# Timer duration config values are not provided for DTS or MSSQL, so skip the
608+
# LongTimerTask and create the TimerTask as normal
609+
610+
action = CreateTimerAction(fire_at)
611+
return LongTimerTask(None, action, self)
619612

620613
action = CreateTimerAction(fire_at)
621614
task = self._generate_task(action, task_constructor=TimerTask)

0 commit comments

Comments
 (0)