Skip to content

Commit

Permalink
simplify create timer
Browse files Browse the repository at this point in the history
  • Loading branch information
hossam-nasr committed Apr 11, 2022
1 parent 121c613 commit 5673d61
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/durableorchestrationcontext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,26 +335,24 @@ export class DurableOrchestrationContext {
*/
public createTimer(fireAt: Date): TimerTask {
const timerAction = new CreateTimerAction(fireAt);
let task: TimerTask;
const durationUntilFire = moment.duration(moment(fireAt).diff(this.currentUtcDateTime));
if (
this.schemaVersion >= ReplaySchema.V3 &&
this.maximumShortTimerDuration &&
this.longRunningTimerIntervalDuration &&
durationUntilFire > this.maximumShortTimerDuration
) {
task = new LongTimerTask(
return new LongTimerTask(
false,
timerAction,
this,
this.taskOrchestratorExecutor,
this.maximumShortTimerDuration,
this.longRunningTimerIntervalDuration
);
} else {
task = new DFTimerTask(false, timerAction);
}
return task;

return new DFTimerTask(false, timerAction);
}

/**
Expand Down

0 comments on commit 5673d61

Please sign in to comment.