fix: make local queue PopItem can be notified (#39011)

This commit is contained in:
wxiaoguang
2026-08-22 09:30:41 +08:00
committed by GitHub
parent 5eba4f92ce
commit d2bc0097bc
11 changed files with 145 additions and 88 deletions
+25
View File
@@ -40,3 +40,28 @@ func popItemByChan(ctx context.Context, popItemFn func(ctx context.Context) ([]b
}()
return chanItem, chanErr
}
type baseQueueNotifiableInterface interface {
getNotifySignalChan() chan struct{}
}
type baseQueueNotifiable struct {
notifySignal chan struct{}
}
var _ baseQueueNotifiableInterface = (*baseQueueNotifiable)(nil)
func (n *baseQueueNotifiable) notifyPushItem() {
select {
case n.notifySignal <- struct{}{}:
default:
}
}
func (n *baseQueueNotifiable) getNotifySignalChan() chan struct{} {
return n.notifySignal
}
func newBaseQueueNotifiable() *baseQueueNotifiable {
return &baseQueueNotifiable{notifySignal: make(chan struct{}, 1)}
}