Skip to content

Commit d82abd9

Browse files
committed
rename q fifo in queue_disk and handle not found err in unique_queue_disk
1 parent c54e2e4 commit d82abd9

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

modules/queue/queue_disk.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,32 +67,32 @@ func NewLevelQueueByteFIFO(dataDir string) (*LevelQueueByteFIFO, error) {
6767
}
6868

6969
// PushFunc will push data into the fifo
70-
func (q *LevelQueueByteFIFO) PushFunc(data []byte, fn func() error) error {
70+
func (fifo *LevelQueueByteFIFO) PushFunc(data []byte, fn func() error) error {
7171
if fn != nil {
7272
if err := fn(); err != nil {
7373
return err
7474
}
7575
}
76-
return q.internal.LPush(data)
76+
return fifo.internal.LPush(data)
7777
}
7878

7979
// Pop pops data from the start of the fifo
80-
func (q *LevelQueueByteFIFO) Pop() ([]byte, error) {
81-
data, err := q.internal.RPop()
80+
func (fifo *LevelQueueByteFIFO) Pop() ([]byte, error) {
81+
data, err := fifo.internal.RPop()
8282
if err != nil && err != levelqueue.ErrNotFound {
8383
return nil, err
8484
}
8585
return data, nil
8686
}
8787

8888
// Close this fifo
89-
func (q *LevelQueueByteFIFO) Close() error {
90-
return q.internal.Close()
89+
func (fifo *LevelQueueByteFIFO) Close() error {
90+
return fifo.internal.Close()
9191
}
9292

9393
// Len returns the length of the fifo
94-
func (q *LevelQueueByteFIFO) Len() int64 {
95-
return q.internal.Len()
94+
func (fifo *LevelQueueByteFIFO) Len() int64 {
95+
return fifo.internal.Len()
9696
}
9797

9898
func init() {

modules/queue/unique_queue_disk.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ func (fifo *LevelUniqueQueueByteFIFO) PushFunc(data []byte, fn func() error) err
7373

7474
// Pop pops data from the start of the fifo
7575
func (fifo *LevelUniqueQueueByteFIFO) Pop() ([]byte, error) {
76-
return fifo.internal.RPop()
76+
data, err := fifo.internal.RPop()
77+
if err != nil && err != levelqueue.ErrNotFound {
78+
return nil, err
79+
}
80+
return data, nil
7781
}
7882

7983
// Len returns the length of the fifo

0 commit comments

Comments
 (0)