Skip to content

Commit 1214ac0

Browse files
authored
Remove timestamp rounding to avoid preliminary timer firing (#765)
1 parent 0c80c52 commit 1214ac0

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

host/activity_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ func (s *integrationSuite) TestActivityHeartbeatDetailsDuringRetry() {
220220
ActivityType: &commonpb.ActivityType{Name: activityName},
221221
TaskQueue: &taskqueuepb.TaskQueue{Name: tl},
222222
Input: nil,
223-
ScheduleToCloseTimeout: timestamp.DurationPtr(4 * time.Second),
224-
ScheduleToStartTimeout: timestamp.DurationPtr(4 * time.Second),
225-
StartToCloseTimeout: timestamp.DurationPtr(4 * time.Second),
223+
ScheduleToCloseTimeout: timestamp.DurationPtr(8 * time.Second),
224+
ScheduleToStartTimeout: timestamp.DurationPtr(8 * time.Second),
225+
StartToCloseTimeout: timestamp.DurationPtr(8 * time.Second),
226226
HeartbeatTimeout: timestamp.DurationPtr(1 * time.Second),
227227
RetryPolicy: &commonpb.RetryPolicy{
228228
InitialInterval: timestamp.DurationPtr(1 * time.Second),

service/history/timerSequence.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,9 @@ func (t *timerSequenceImpl) isExpired(
9999
referenceTime time.Time,
100100
timerSequenceID timerSequenceID,
101101
) bool {
102-
103-
// Cassandra timestamp resolution is in millisecond
104-
// here we do the check in terms of second resolution.
105-
return timerSequenceID.timestamp.Unix() <= referenceTime.Unix()
102+
// TODO: Cassandra timestamp resolution is in millisecond.
103+
// Verify if it can create any problem here.
104+
return !timerSequenceID.timestamp.After(referenceTime)
106105
}
107106

108107
func (t *timerSequenceImpl) createNextUserTimer() (bool, error) {

0 commit comments

Comments
 (0)