Skip to content

Commit

Permalink
Ensure close and lock don't race
Browse files Browse the repository at this point in the history
Fixes #440
  • Loading branch information
turt2live committed Aug 26, 2023
1 parent abef43e commit 0ecfc70
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tasks/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ func scheduleHourly(name RecurringTaskName, workFn RecurringTaskFn) {
recurDoneChs[name] = ch
go func() {
defer func() {
close(ch)
recurLock.Lock()
defer recurLock.Unlock()
close(ch)
if recurDoneChs[name] == ch {
delete(recurDoneChs, name)
}
Expand Down

0 comments on commit 0ecfc70

Please sign in to comment.