summaryrefslogtreecommitdiffstats
path: root/modules/queue
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-02-12 18:12:27 +0800
committerGitHub <noreply@github.com>2020-02-12 18:12:27 +0800
commit3d69bbd58f1214325b9133caa439a09ba952ed30 (patch)
tree217746d1805755b639fce8dfed6fe007429dc368 /modules/queue
parent83a8944fcf64af9bf5b0a4e233f9a7f917838a4d (diff)
downloadgitea-3d69bbd58f1214325b9133caa439a09ba952ed30.tar.gz
gitea-3d69bbd58f1214325b9133caa439a09ba952ed30.zip
Fix queue pop error and stat empty repository error (#10248)
* Fix queue pop error and stat empty repository error * Fix error
Diffstat (limited to 'modules/queue')
-rw-r--r--modules/queue/queue_redis.go2
-rw-r--r--modules/queue/unique_queue_redis.go4
2 files changed, 4 insertions, 2 deletions
diff --git a/modules/queue/queue_redis.go b/modules/queue/queue_redis.go
index 8a395cd5aa..4e05ddd17e 100644
--- a/modules/queue/queue_redis.go
+++ b/modules/queue/queue_redis.go
@@ -121,7 +121,7 @@ func (fifo *RedisByteFIFO) PushFunc(data []byte, fn func() error) error {
// Pop pops data from the start of the fifo
func (fifo *RedisByteFIFO) Pop() ([]byte, error) {
data, err := fifo.client.LPop(fifo.queueName).Bytes()
- if err != nil && err == redis.Nil {
+ if err == nil || err == redis.Nil {
return data, nil
}
return data, err
diff --git a/modules/queue/unique_queue_redis.go b/modules/queue/unique_queue_redis.go
index e5b2c48dbb..9404369075 100644
--- a/modules/queue/unique_queue_redis.go
+++ b/modules/queue/unique_queue_redis.go
@@ -4,6 +4,8 @@
package queue
+import "github.com/go-redis/redis"
+
// RedisUniqueQueueType is the type for redis queue
const RedisUniqueQueueType Type = "unique-redis"
@@ -102,7 +104,7 @@ func (fifo *RedisUniqueByteFIFO) PushFunc(data []byte, fn func() error) error {
// Pop pops data from the start of the fifo
func (fifo *RedisUniqueByteFIFO) Pop() ([]byte, error) {
data, err := fifo.client.LPop(fifo.queueName).Bytes()
- if err != nil {
+ if err != nil && err != redis.Nil {
return data, err
}