diff options
author | n1t0r <git@n1t0r.com> | 2023-04-21 20:02:33 +1000 |
---|---|---|
committer | n1t0r <git@n1t0r.com> | 2023-04-21 20:02:33 +1000 |
commit | ba5a67a7bdd3d73309d34c50a2149dee2b3213b8 (patch) | |
tree | 3ca410ae407d6952366182c389d94d23949dcea8 | |
parent | 6fc264eb52036ee6011d091d9ecdfa52923d6561 (diff) | |
download | steady-ba5a67a7bdd3d73309d34c50a2149dee2b3213b8.tar.gz steady-ba5a67a7bdd3d73309d34c50a2149dee2b3213b8.tar.bz2 steady-ba5a67a7bdd3d73309d34c50a2149dee2b3213b8.zip |
Delete key from partitions map if it is empty.
-rw-r--r-- | queue.go | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -244,6 +244,9 @@ func (q *Queue[K]) Pop() (item Item[K], ok bool) { q.snoozeQ.Push(key, time.Now().Add(q.interval()).UnixMicro()) q.snoozeQNotEmpty.Signal() } else { + q.partitionsMu.Lock() + delete(q.partitions, key) + q.partitionsMu.Unlock() q.inactiveKeys[key] = time.Now().Add(q.interval()) } q.snoozeQMu.Unlock() |