async: never close updated channel The update loop sometimes schedules an update over this output channel onto the worker pool. This update races against the loader shutting down and closing its output channel before the scheduled update does a send. This results in a panic from the scheduled goroutine that is impossible for applications to gracefully handle. It's better for the updated channel to stay open than for it to crash. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
1 files changed, 2 insertions(+), 2 deletions(-) M async/loader.go
M async/loader.go => async/loader.go +2 -2
@@ 182,6 182,8 @@ type loader struct { // // case <-loader.Updated(): // w.Invalidate() // // The channel returned from Updated will never close. func (l *Loader) Updated() <-chan struct{} { l.init.Do(l.initialize) @@ return l.updated 279,8 281,6 @@ func (l *Loader) run(ctx context.Context) { <-ctx.Done() l.refresh.Signal() }() defer close(l.updated) loader := &l.loader loader.mu.Lock()