Copilot commented on code in PR #1216:
URL:
https://github.com/apache/skywalking-banyandb/pull/1216#discussion_r3566249111
##########
banyand/internal/storage/disk_monitor.go:
##########
@@ -145,6 +147,8 @@ func NewDiskMonitor(service RetentionService, config
RetentionConfig, omr observ
func (dm *DiskMonitor) Start() {
if dm.config.CheckInterval <= 0 {
dm.logger.Warn().Msg("disk monitor check interval is 0 or
negative, monitor disabled")
+ // No monitor loop will run, so release Stop()'s wait
immediately.
+ close(dm.doneCh)
return
Review Comment:
Stop() now blocks on doneCh, but doneCh is only closed by monitorLoop (or by
the CheckInterval<=0 branch). If Stop() is ever called before Start() (or
Start() returns early before launching the loop), <-dm.doneCh will block
forever. To keep Stop() safe in the “never started” case, consider making
doneCh closed by default and reinitializing it only when a monitor loop is
actually started (and avoid closing doneCh in the disabled Start path).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]