mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Fix queue pop error and stat empty repository error (#10248)
* Fix queue pop error and stat empty repository error * Fix error
This commit is contained in:
		@@ -19,6 +19,10 @@ func (db *DBIndexer) Index(id int64) error {
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if repo.IsEmpty {
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	status, err := repo.GetIndexerStatus(models.RepoIndexerTypeStats)
 | 
						status, err := repo.GetIndexerStatus(models.RepoIndexerTypeStats)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -121,7 +121,7 @@ func (fifo *RedisByteFIFO) PushFunc(data []byte, fn func() error) error {
 | 
				
			|||||||
// Pop pops data from the start of the fifo
 | 
					// Pop pops data from the start of the fifo
 | 
				
			||||||
func (fifo *RedisByteFIFO) Pop() ([]byte, error) {
 | 
					func (fifo *RedisByteFIFO) Pop() ([]byte, error) {
 | 
				
			||||||
	data, err := fifo.client.LPop(fifo.queueName).Bytes()
 | 
						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, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return data, err
 | 
						return data, err
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package queue
 | 
					package queue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/go-redis/redis"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// RedisUniqueQueueType is the type for redis queue
 | 
					// RedisUniqueQueueType is the type for redis queue
 | 
				
			||||||
const RedisUniqueQueueType Type = "unique-redis"
 | 
					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
 | 
					// Pop pops data from the start of the fifo
 | 
				
			||||||
func (fifo *RedisUniqueByteFIFO) Pop() ([]byte, error) {
 | 
					func (fifo *RedisUniqueByteFIFO) Pop() ([]byte, error) {
 | 
				
			||||||
	data, err := fifo.client.LPop(fifo.queueName).Bytes()
 | 
						data, err := fifo.client.LPop(fifo.queueName).Bytes()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil && err != redis.Nil {
 | 
				
			||||||
		return data, err
 | 
							return data, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user