Skip to content

Commit 543479c

Browse files
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 7b0cf2d commit 543479c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

protocol/logger/job_logger.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,19 @@ func (i *internalBufferedLiveLoggerData) isZero() bool {
250250
}
251251

252252
func (i *internalBufferedLiveLoggerData) queueLog(wrapper *protocol.TimelineRecordFeedLinesWrapper) error {
253+
// First, non-blocking check: if logdrain is already closed, do not allow new logs.
253254
select {
254255
case <-i.logdrain:
255256
return errors.New("buffered live logger closing")
257+
default:
258+
}
259+
260+
// Then, attempt to enqueue the log while still respecting logdrain if it closes concurrently.
261+
select {
256262
case i.logchan <- wrapper:
257263
return nil
264+
case <-i.logdrain:
265+
return errors.New("buffered live logger closing")
258266
}
259267
}
260268

0 commit comments

Comments
 (0)