File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,13 @@ func (l *LifoBlockingListener) unblock() {
122
122
if l .limiter .backlog .len () > 0 {
123
123
124
124
evict , nextEvent := l .limiter .backlog .peek ()
125
+
126
+ // Last element expired between us checking the
127
+ // queue length and invoking peek
128
+ if nextEvent == nil {
129
+ return
130
+ }
131
+
125
132
listener , ok := l .limiter .delegate .Acquire (nextEvent .ctx )
126
133
127
134
if ok && listener != nil {
@@ -175,7 +182,6 @@ type LifoBlockingLimiter struct {
175
182
maxBacklogTimeout time.Duration
176
183
177
184
backlog lifoQueue
178
- c * sync.Cond
179
185
mu sync.RWMutex
180
186
}
181
187
@@ -191,13 +197,11 @@ func NewLifoBlockingLimiter(
191
197
if maxBacklogTimeout == 0 {
192
198
maxBacklogTimeout = time .Millisecond * 1000
193
199
}
194
- mu := sync.Mutex {}
195
200
return & LifoBlockingLimiter {
196
201
delegate : delegate ,
197
202
maxBacklogSize : uint64 (maxBacklogSize ),
198
203
maxBacklogTimeout : maxBacklogTimeout ,
199
204
backlog : lifoQueue {},
200
- c : sync .NewCond (& mu ),
201
205
}
202
206
}
203
207
You can’t perform that action at this time.
0 commit comments