浏览代码

Fix queue pop error and stat empty repository error (#10248)

* Fix queue pop error and stat empty repository error

* Fix error
tags/v1.10.5
Lunny Xiao 4 年前
父节点
当前提交
3d69bbd58f
没有帐户链接到提交者的电子邮件
共有 3 个文件被更改,包括 8 次插入2 次删除
  1. 4
    0
      modules/indexer/stats/db.go
  2. 1
    1
      modules/queue/queue_redis.go
  3. 3
    1
      modules/queue/unique_queue_redis.go

+ 4
- 0
modules/indexer/stats/db.go 查看文件

@@ -19,6 +19,10 @@ func (db *DBIndexer) Index(id int64) error {
if err != nil {
return err
}
if repo.IsEmpty {
return nil
}

status, err := repo.GetIndexerStatus(models.RepoIndexerTypeStats)
if err != nil {
return err

+ 1
- 1
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

+ 3
- 1
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
}


正在加载...
取消
保存