Fix 'empty queue' error when satellite starts (#939)
This commit is contained in:
parent
e4b3dab446
commit
b712fbcbb0
@ -49,7 +49,7 @@ func (q *Queue) Enqueue(ctx context.Context, qi *pb.InjuredSegment) error {
|
||||
func (q *Queue) Dequeue(ctx context.Context) (pb.InjuredSegment, error) {
|
||||
val, err := q.db.Dequeue()
|
||||
if err != nil {
|
||||
if err == storage.ErrEmptyQueue {
|
||||
if storage.ErrEmptyQueue.Has(err) {
|
||||
return pb.InjuredSegment{}, err
|
||||
}
|
||||
return pb.InjuredSegment{}, Error.New("error obtaining item from repair queue %s", err)
|
||||
|
@ -62,7 +62,7 @@ func (service *repairService) Run(ctx context.Context) (err error) {
|
||||
func (service *repairService) process(ctx context.Context) error {
|
||||
seg, err := service.queue.Dequeue(ctx)
|
||||
if err != nil {
|
||||
if err == storage.ErrEmptyQueue {
|
||||
if storage.ErrEmptyQueue.Has(err) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
|
@ -42,7 +42,7 @@ func (r *repairQueue) Dequeue(ctx context.Context) (pb.InjuredSegment, error) {
|
||||
if err != nil {
|
||||
return pb.InjuredSegment{}, Error.Wrap(utils.CombineErrors(err, tx.Rollback()))
|
||||
} else if res == nil {
|
||||
return pb.InjuredSegment{}, Error.Wrap(utils.CombineErrors(storage.ErrEmptyQueue, tx.Rollback()))
|
||||
return pb.InjuredSegment{}, Error.Wrap(utils.CombineErrors(storage.ErrEmptyQueue.New(""), tx.Rollback()))
|
||||
}
|
||||
|
||||
deleted, err := tx.Delete_Injuredsegment_By_Id(
|
||||
|
@ -20,7 +20,7 @@ var ErrKeyNotFound = errs.Class("key not found")
|
||||
var ErrEmptyKey = errs.Class("empty key")
|
||||
|
||||
// ErrEmptyQueue is returned when attempting to Dequeue from an empty queue
|
||||
var ErrEmptyQueue = errors.New("empty queue")
|
||||
var ErrEmptyQueue = errs.Class("empty queue")
|
||||
|
||||
// ErrLimitExceeded is returned when request limit is exceeded
|
||||
var ErrLimitExceeded = errors.New("limit exceeded")
|
||||
|
@ -45,7 +45,7 @@ func (client *Queue) Dequeue() (storage.Value, error) {
|
||||
out, err := client.db.RPop(queueKey).Bytes()
|
||||
if err != nil {
|
||||
if err == redis.Nil {
|
||||
return nil, storage.ErrEmptyQueue
|
||||
return nil, storage.ErrEmptyQueue.New("")
|
||||
}
|
||||
return nil, Error.New("dequeue error: %v", err)
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ func (q *Queue) Dequeue() (storage.Value, error) {
|
||||
q.s.Remove(e) // Dequeue
|
||||
return e.Value.(storage.Value), nil
|
||||
}
|
||||
return nil, storage.ErrEmptyQueue
|
||||
return nil, storage.ErrEmptyQueue.New("")
|
||||
}
|
||||
|
||||
//Peekqueue gets upto 'limit' entries from the list queue
|
||||
|
Loading…
Reference in New Issue
Block a user