mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-10 16:48:21 +00:00
fix: make local queue PopItem can be notified (#39011)
This commit is contained in:
1 parent
5eba4f92ce
commit
d2bc0097bc
11 files changed
+145
-88
No files matched your search
@@ -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