Skip to content

Commit 209ad5f

Browse files
committed
[*] use Max() in getTimeoutContext() instead of direct comparison
1 parent 884778b commit 209ad5f

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

internal/scheduler/chain.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,7 @@ func (sch *Scheduler) chainWorker(ctx context.Context, chains <-chan Chain) {
156156
}
157157

158158
func getTimeoutContext(ctx context.Context, t1 int, t2 int) (context.Context, context.CancelFunc) {
159-
var timeout int
160-
if t1 > t2 {
161-
timeout = t1
162-
} else {
163-
timeout = t2
164-
}
159+
timeout := Max(t1, t2)
165160
if timeout > 0 {
166161
return context.WithTimeout(ctx, time.Millisecond*time.Duration(timeout))
167162
}

0 commit comments

Comments
 (0)