Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove timestamp rounding to avoid preliminary timer firing #765

Merged
merged 5 commits into from
Sep 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions host/activity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ func (s *integrationSuite) TestActivityHeartbeatDetailsDuringRetry() {
ActivityType: &commonpb.ActivityType{Name: activityName},
TaskQueue: &taskqueuepb.TaskQueue{Name: tl},
Input: nil,
ScheduleToCloseTimeout: timestamp.DurationPtr(4 * time.Second),
ScheduleToStartTimeout: timestamp.DurationPtr(4 * time.Second),
StartToCloseTimeout: timestamp.DurationPtr(4 * time.Second),
ScheduleToCloseTimeout: timestamp.DurationPtr(8 * time.Second),
ScheduleToStartTimeout: timestamp.DurationPtr(8 * time.Second),
StartToCloseTimeout: timestamp.DurationPtr(8 * time.Second),
samarabbas marked this conversation as resolved.
Show resolved Hide resolved
HeartbeatTimeout: timestamp.DurationPtr(1 * time.Second),
RetryPolicy: &commonpb.RetryPolicy{
InitialInterval: timestamp.DurationPtr(1 * time.Second),
Expand Down
7 changes: 3 additions & 4 deletions service/history/timerSequence.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,9 @@ func (t *timerSequenceImpl) isExpired(
referenceTime time.Time,
timerSequenceID timerSequenceID,
) bool {

// Cassandra timestamp resolution is in millisecond
// here we do the check in terms of second resolution.
return timerSequenceID.timestamp.Unix() <= referenceTime.Unix()
// TODO: Cassandra timestamp resolution is in millisecond.
// Verify if it can create any problem here.
return !timerSequenceID.timestamp.After(referenceTime)
}

func (t *timerSequenceImpl) createNextUserTimer() (bool, error) {
Expand Down