Skip to content

Commit

Permalink
Properly handle infinite activity timeout (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
wxing1292 authored Dec 10, 2020
1 parent a0afa20 commit 574fd84
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions internal/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,16 @@ func WithActivityTask(
scheduleToCloseTimeout := common.DurationValue(task.GetScheduleToCloseTimeout())
startToCloseTimeout := common.DurationValue(task.GetStartToCloseTimeout())
heartbeatTimeout := common.DurationValue(task.GetHeartbeatTimeout())
scheduleToCloseDeadline := scheduled.Add(scheduleToCloseTimeout)

startToCloseDeadline := started.Add(startToCloseTimeout)
// Minimum of the two deadlines.
if scheduleToCloseDeadline.Before(startToCloseDeadline) {
deadline = scheduleToCloseDeadline
if scheduleToCloseTimeout > 0 {
scheduleToCloseDeadline := scheduled.Add(scheduleToCloseTimeout)
// Minimum of the two deadlines.
if scheduleToCloseDeadline.Before(startToCloseDeadline) {
deadline = scheduleToCloseDeadline
} else {
deadline = startToCloseDeadline
}
} else {
deadline = startToCloseDeadline
}
Expand Down

0 comments on commit 574fd84

Please sign in to comment.