diff options
author | zeripath <art27@cantab.net> | 2022-01-24 22:54:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-24 22:54:35 +0000 |
commit | ab7f70167100b69dc66f988d2df0bbd639f405be (patch) | |
tree | 26bb6c394a4ee46db9330d6226fe3a8c6b9382c1 /modules/queue/unique_queue_disk_channel.go | |
parent | 43c6b27716381dad9debd2ebbd9e1ae332af23b2 (diff) | |
download | gitea-ab7f70167100b69dc66f988d2df0bbd639f405be.tar.gz gitea-ab7f70167100b69dc66f988d2df0bbd639f405be.zip |
Make WrappedQueues and PersistableChannelUniqueQueues Pausable (#18393)
Implements the Pausable interface on WrappedQueues and PersistableChannelUniqueQueues
Reference #15928
Signed-off-by: Andrew Thornton art27@cantab.net
Diffstat (limited to 'modules/queue/unique_queue_disk_channel.go')
-rw-r--r-- | modules/queue/unique_queue_disk_channel.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/queue/unique_queue_disk_channel.go b/modules/queue/unique_queue_disk_channel.go index 7fc304b17e..ac7919926f 100644 --- a/modules/queue/unique_queue_disk_channel.go +++ b/modules/queue/unique_queue_disk_channel.go @@ -239,6 +239,26 @@ func (q *PersistableChannelUniqueQueue) IsEmpty() bool { return q.channelQueue.IsEmpty() } +// IsPaused will return if the pool or queue is paused +func (q *PersistableChannelUniqueQueue) IsPaused() bool { + return q.channelQueue.IsPaused() +} + +// Pause will pause the pool or queue +func (q *PersistableChannelUniqueQueue) Pause() { + q.channelQueue.Pause() +} + +// Resume will resume the pool or queue +func (q *PersistableChannelUniqueQueue) Resume() { + q.channelQueue.Resume() +} + +// IsPausedIsResumed will return a bool indicating if the pool or queue is paused and a channel that will be closed when it is resumed +func (q *PersistableChannelUniqueQueue) IsPausedIsResumed() (paused, resumed <-chan struct{}) { + return q.channelQueue.IsPausedIsResumed() +} + // Shutdown processing this queue func (q *PersistableChannelUniqueQueue) Shutdown() { log.Trace("PersistableChannelUniqueQueue: %s Shutting down", q.delayedStarter.name) |