@@ -551,26 +551,29 @@ func (wc *workflowEnvironmentImpl) Now() time.Time {
551
551
}
552
552
553
553
func (wc * workflowEnvironmentImpl ) NewTimer (d time.Duration , callback resultHandler ) * timerInfo {
554
- if d < 0 {
555
- callback (nil , fmt .Errorf ("negative duration provided %v" , d ))
554
+ durationInSeconds := common .Int64Ceil (d .Seconds ())
555
+ if durationInSeconds < 0 {
556
+ callback (nil , fmt .Errorf ("negative duration provided %v" , durationInSeconds ))
556
557
return nil
557
558
}
558
- if d == 0 {
559
+ if durationInSeconds == 0 {
559
560
callback (nil , nil )
560
561
return nil
561
562
}
562
563
563
564
timerID := wc .GenerateSequenceID ()
564
565
startTimerAttr := & m.StartTimerDecisionAttributes {}
565
566
startTimerAttr .TimerId = common .StringPtr (timerID )
566
- startTimerAttr .StartToFireTimeoutSeconds = common .Int64Ptr (common . Int64Ceil ( d . Seconds ()) )
567
+ startTimerAttr .StartToFireTimeoutSeconds = common .Int64Ptr (durationInSeconds )
567
568
568
569
decision := wc .decisionsHelper .startTimer (startTimerAttr )
569
570
decision .setData (& scheduledTimer {callback : callback })
570
571
571
572
wc .logger .Debug ("NewTimer" ,
572
573
zap .String (tagTimerID , startTimerAttr .GetTimerId ()),
573
- zap .Duration ("Duration" , d ))
574
+ zap .Duration ("Duration" , d ),
575
+ zap .Int64 ("DurationInSeconds" , durationInSeconds ),
576
+ )
574
577
575
578
return & timerInfo {timerID : timerID }
576
579
}
0 commit comments