mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-23 20:00:30 +00:00
fix: make local queue PopItem can be notified (#39011)
This commit is contained in:
@@ -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)}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user