Commit e741213 1 parent 8891f94 commit e741213 Copy full SHA for e741213
File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ func (rt *rtQ) getMessageBatch() MessageBatch {
97
97
Uuid : uuidV4 .String (),
98
98
}
99
99
100
- rt .db .View (func (tx * bolt.Tx ) error {
100
+ err := rt .db .View (func (tx * bolt.Tx ) error {
101
101
bucket := tx .Bucket ([]byte ("mq" ))
102
102
103
103
// get bucket stats
@@ -128,7 +128,11 @@ func (rt *rtQ) getMessageBatch() MessageBatch {
128
128
i := 1
129
129
for k , v := c .First (); k != nil ; k , v = c .Next () {
130
130
msg := Message {}
131
- json .Unmarshal (v , & msg )
131
+ err := json .Unmarshal (v , & msg )
132
+ if err != nil {
133
+ rt .cfg .Logger .Warn ("Can not unmarshal queued entry: " + err .Error ())
134
+ continue
135
+ }
132
136
mb .Messages = append (mb .Messages , msg )
133
137
i ++
134
138
if i > rt .cfg .Batch {
@@ -139,6 +143,10 @@ func (rt *rtQ) getMessageBatch() MessageBatch {
139
143
return nil
140
144
})
141
145
146
+ if err != nil {
147
+ rt .cfg .Logger .Error ("bbolt db View error: " + err .Error ())
148
+ }
149
+
142
150
mb .Size = len (mb .Messages )
143
151
144
152
return mb
You can’t perform that action at this time.
0 commit comments