Do not enqueue after stop. (#2457)

Else, that could leak as the process routine may have exited and the
entries are not processed anywhere.
This commit is contained in:
Raja Subramanian
2024-02-06 19:01:24 +05:30
committed by GitHub
parent be87a1b6f0
commit 2f9ec2117f

View File

@@ -75,8 +75,12 @@ func (oq *OpsQueue) Enqueue(op func()) {
oq.lock.Lock()
defer oq.lock.Unlock()
if oq.isStopped {
return
}
oq.ops.PushBack(op)
if oq.ops.Len() == 1 && !oq.isStopped {
if oq.ops.Len() == 1 {
select {
case oq.wake <- struct{}{}:
default: