Closed cgillum closed 11 months ago
In DaprWorkflowContext the create_timer method is defined as follows:
DaprWorkflowContext
create_timer
def create_timer(self, fire_at: datetime) -> task.Task:
However, it would be more convenient to also support timedelta as a parameter type. Note that the undelrying Durable Task SDK already supports this:
timedelta
def create_timer(self, fire_at: Union[datetime, timedelta]) -> Task:
The workaround is that developers must do the following:
ctx.create_timer(ctx.current_utc_datetime + SOME_TIME_DELTA)
This workaround is problematic because it can tempt users to violate code constraint rules if they accidentally use datetime.now(), which is non-deterministic, instead of ctx.current_utc_datetime.
datetime.now()
ctx.current_utc_datetime
Ideally, users could simply write the following:
ctx.create_timer(SOME_TIME_DELTA)
Describe the proposal
In
DaprWorkflowContext
thecreate_timer
method is defined as follows:However, it would be more convenient to also support
timedelta
as a parameter type. Note that the undelrying Durable Task SDK already supports this:The workaround is that developers must do the following:
This workaround is problematic because it can tempt users to violate code constraint rules if they accidentally use
datetime.now()
, which is non-deterministic, instead ofctx.current_utc_datetime
.Ideally, users could simply write the following: