Add TestCancelationPubSubReceiveError to verify that when
Receive() fails in CancelationPubSub(), an error is returned
and the pubsub connection is not leaked.
This provides test coverage for the pubsub.Close() fix that
was missing in the previous commit.
Bahtya
When redis.Subscribe succeeds but Receive() fails, the pubsub
connection was not being closed before returning the error. This caused
the subscriber goroutine to leak a Redis connection on each retry
iteration, eventually exhausting the connection pool.
Fixes#1095
MEMORY USAGE returns nil for keys that no longer exist (e.g., expired
or deleted task keys). In Lua, nil is converted to false (a boolean).
The script then attempts arithmetic on this boolean value, causing:
ERR user_script:30: attempt to perform arithmetic on local 'bytes'
(a boolean value)
This breaks the /api/queues endpoint in asynqmon, showing "Could not
retrieve queues live data" in the UI.
The fix adds nil guards around all three MEMORY USAGE calls on task
keys, and a divide-by-zero guard on agg_task_sample_size.
Tested in production with Redis 7.2 and asynq v0.25.1 worker.
Fixes#728
Related to #901
* prepare release (docs): v0.25.0
* docs: add PR 946 to changelog
* docs: update issue templates, add releatively stable update
* Ths project should be considered relatively stable because we haven't broken the API in over 2 years.
* docs: add Redis Cluster compatibility caveat
* Improve performance of enqueueing tasks
Add an in-memory cache to keep track of all the queues. Use this cache
to avoid sending an SADD since after the first call, that extra network
call isn't necessary.
The cache will expire every 10 secs so for cases where the queue is
deleted from asynq:queues set, it can be added again next time a task is
enqueued to it.
* Use sync.Map to simplify the conditional SADD
* Cleanup queuePublished in RemoveQueue
---------
Co-authored-by: Yousif <753751+yousifh@users.noreply.github.com>
* feature: configurable janitor interval and deletion batch size
* warn user when they set a big number of janitor batch size
* Update CHANGELOG.md
---------
Co-authored-by: Agung Hariadi Tedja <agung.tedja@kumparan.com>