File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ package redisdb
3
3
import (
4
4
"context"
5
5
"encoding/json"
6
+ "errors"
7
+ "fmt"
6
8
"strings"
7
9
"sync"
8
10
"sync/atomic"
@@ -83,7 +85,11 @@ func (w *Worker) startConsumer() {
83
85
w .opts .group ,
84
86
"$" ,
85
87
).Err (); err != nil {
86
- w .opts .logger .Error (err )
88
+ if err .Error () == "BUSYGROUP Consumer Group name already exists" {
89
+ w .opts .logger .Info (err )
90
+ } else {
91
+ w .opts .logger .Error (err )
92
+ }
87
93
}
88
94
89
95
go w .fetchTask ()
@@ -110,7 +116,14 @@ func (w *Worker) fetchTask() {
110
116
Block : w .opts .blockTime ,
111
117
}).Result ()
112
118
if err != nil {
113
- w .opts .logger .Errorf ("error while reading from redis %v" , err )
119
+ workerInfo := fmt .Sprintf ("{streamName: %q, group: %q, consumer: %q}" ,
120
+ w .opts .streamName , w .opts .group , w .opts .consumer )
121
+ if errors .Is (err , redis .Nil ) {
122
+ w .opts .logger .Infof ("no data while reading from redis stream %s" , workerInfo )
123
+ } else {
124
+ w .opts .logger .Errorf ("error while reading from redis %s %v" , workerInfo , err )
125
+ }
126
+
114
127
continue
115
128
}
116
129
// we have received the data we should loop it and queue the messages
You can’t perform that action at this time.
0 commit comments