Skip to content

Commit cb1afb3

Browse files
authored
common: fix task leak in timer (#4831)
signal包里面SetTimeout方法并发时可能会出现task close以后执行start导致泄露
1 parent 38ed2cc commit cb1afb3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

common/signal/timer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ func (t *ActivityTimer) SetTimeout(timeout time.Duration) {
6767
t.checkTask.Close()
6868
}
6969
t.checkTask = checkTask
70-
t.Unlock()
7170
t.Update()
7271
common.Must(checkTask.Start())
72+
t.Unlock()
7373
}
7474

7575
func CancelAfterInactivity(ctx context.Context, cancel context.CancelFunc, timeout time.Duration) *ActivityTimer {

0 commit comments

Comments
 (0)