Handle flow updates (#3455)

This commit is contained in:
Viktor Liu
2025-03-07 13:56:00 +01:00
committed by GitHub
parent 3c3a454e61
commit 54be772ffd
4 changed files with 154 additions and 94 deletions
+3 -1
View File
@@ -58,13 +58,14 @@ func (l *Logger) startReceiver() {
if l.enabled.Load() {
return
}
l.mux.Lock()
ctx, cancel := context.WithCancel(l.ctx)
l.cancelReceiver = cancel
l.mux.Unlock()
c := make(rcvChan, 100)
l.rcvChan.Swap(&c)
l.rcvChan.Store(&c)
l.enabled.Store(true)
for {
@@ -100,6 +101,7 @@ func (l *Logger) stop() {
l.cancelReceiver()
l.cancelReceiver = nil
}
l.rcvChan.Store(nil)
l.mux.Unlock()
}