From 5673d61e69d33d46ab99ea3a74e91a8671afc82c Mon Sep 17 00:00:00 2001 From: hossam-nasr Date: Fri, 8 Apr 2022 20:46:57 -0700 Subject: [PATCH] simplify create timer --- src/durableorchestrationcontext.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/durableorchestrationcontext.ts b/src/durableorchestrationcontext.ts index adcfbd3..77080ae 100644 --- a/src/durableorchestrationcontext.ts +++ b/src/durableorchestrationcontext.ts @@ -335,7 +335,6 @@ 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 && @@ -343,7 +342,7 @@ export class DurableOrchestrationContext { this.longRunningTimerIntervalDuration && durationUntilFire > this.maximumShortTimerDuration ) { - task = new LongTimerTask( + return new LongTimerTask( false, timerAction, this, @@ -351,10 +350,9 @@ export class DurableOrchestrationContext { this.maximumShortTimerDuration, this.longRunningTimerIntervalDuration ); - } else { - task = new DFTimerTask(false, timerAction); } - return task; + + return new DFTimerTask(false, timerAction); } /**