File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ func (a *APIServer) dequeue(now time.Time, cb func(msg *pendingMsg) bool) {
223
223
a .queueLock .Lock ()
224
224
defer a .queueLock .Unlock ()
225
225
226
- a .queue = slices . DeleteFunc (a .queue , func (msg * pendingMsg ) bool {
226
+ a .queue = slicesDeleteUntilFalse (a .queue , func (msg * pendingMsg ) bool {
227
227
if msg .sendAfter .After (now ) {
228
228
return false
229
229
}
@@ -245,6 +245,17 @@ func (a *APIServer) dequeue(now time.Time, cb func(msg *pendingMsg) bool) {
245
245
})
246
246
}
247
247
248
+ // slicesDeleteUntilFalse deletes elements from the slice until the function f returns false.
249
+ func slicesDeleteUntilFalse (s []* pendingMsg , f func (* pendingMsg ) bool ) []* pendingMsg {
250
+ for i , v := range s {
251
+ if ! f (v ) {
252
+ return s [i :]
253
+ }
254
+ }
255
+
256
+ return nil
257
+ }
258
+
248
259
func (a * APIServer ) updateMsgService (msg * api.SecurityEventMessage ) {
249
260
// look for the service tag if we don't have one yet
250
261
if len (msg .Service ) == 0 {
You can’t perform that action at this time.
0 commit comments