Skip to content

Commit 688ad3f

Browse files
yacovmsamliok
andauthored
Fix data race in timeout handler (#339)
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org> Co-authored-by: Sam Liokumovich <65994425+samliok@users.noreply.github.com>
1 parent 470bfba commit 688ad3f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

timeout_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ func (t *TimeoutHandler[T]) run(startTime time.Time) {
7777
}
7878

7979
func (t *TimeoutHandler[T]) maybeRunTasks() {
80+
t.lock.Lock()
8081
ids := make([]T, 0, len(t.tasks))
8182

82-
t.lock.Lock()
8383
for id := range t.tasks {
8484
ids = append(ids, id)
8585
}

0 commit comments

Comments
 (0)