diff options
author | zeripath <art27@cantab.net> | 2022-02-12 05:31:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 13:31:26 +0800 |
commit | 4e57bd1d307d20341e9ae5cdb6aeb7913bd1f59d (patch) | |
tree | 96563a9a4344cfa25902abcfd723fe6fb7b9644c /modules/queue/queue_bytefifo.go | |
parent | 9444135ff5fe5e6929fc945ad0f40d77ca17c340 (diff) | |
download | gitea-4e57bd1d307d20341e9ae5cdb6aeb7913bd1f59d.tar.gz gitea-4e57bd1d307d20341e9ae5cdb6aeb7913bd1f59d.zip |
Add number in queue status to monitor page (#18712)
Add number in queue status to the monitor page so that administrators can
assess how much work is left to be done in the queues.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'modules/queue/queue_bytefifo.go')
-rw-r--r-- | modules/queue/queue_bytefifo.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/queue/queue_bytefifo.go b/modules/queue/queue_bytefifo.go index bf153d70bb..ead3828f33 100644 --- a/modules/queue/queue_bytefifo.go +++ b/modules/queue/queue_bytefifo.go @@ -135,6 +135,13 @@ func (q *ByteFIFOQueue) IsEmpty() bool { return q.byteFIFO.Len(q.terminateCtx) == 0 } +// NumberInQueue returns the number in the queue +func (q *ByteFIFOQueue) NumberInQueue() int64 { + q.lock.Lock() + defer q.lock.Unlock() + return q.byteFIFO.Len(q.terminateCtx) + q.WorkerPool.NumberInQueue() +} + // Flush flushes the ByteFIFOQueue func (q *ByteFIFOQueue) Flush(timeout time.Duration) error { select { |