We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We are using Rails 6.1 and ActiveSupport::Cache::RedisStore as the store and recently found that status keys are not expiring.
ActiveSupport::Cache::RedisStore
The expires_in value is only specified when a job is enqueued, not for the other statuses: https://github.com/cdale77/active_job_status/blob/master/lib/active_job_status/job_tracker.rb#L11-L31
expires_in
It appears that when the status is updated, the expiration on the key is cleared. This may be behavior that has changed at some point.
It would be better to specify an expires_in value for all status updates to ensure that keys are cleaned up.
We worked around this issue by configuring a default expires_in value for the store:
ActiveJobStatus.store = ActiveSupport::Cache::RedisStore.new(expires_in: 3.days)
Reproduction of the issuing using a console:
Running via Spring preloader in process 77990 Loading development environment (Rails 6.1.3.2) [1] pry(main)> job_id = SecureRandom.uuid => "ca1222e4-5bb3-4b02-978d-dfec4f03f108" [2] pry(main)> ActiveJobStatus.store.write(job_id, "queued", expires_in: 3.days) => "OK" [3] pry(main)> ActiveJobStatus.store.send(:read_entry, job_id) => #<ActiveSupport::Cache::Entry:0x00007fadd78f5818 @created_at=1621937433.6319191, @expires_in=259200.0, @value="queued", @version=nil> [4] pry(main)> ActiveJobStatus.store.redis.ttl(job_id) => 259170 [5] pry(main)> ActiveJobStatus.store.write(job_id, "working") # update without expires_in => "OK" [6] pry(main)> ActiveJobStatus.store.send(:read_entry, job_id) => #<ActiveSupport::Cache::Entry:0x00007fadd63b18f8 @created_at=1621937483.174815, @expires_in=nil, @value="working", @version=nil> # expires_in value cleared from entry [7] pry(main)> ActiveJobStatus.store.redis.ttl(job_id) => -1 # querying the key directly shows no TTL in redis [8] pry(main)> ActiveJobStatus.store.class => ActiveSupport::Cache::RedisCacheStore
The text was updated successfully, but these errors were encountered:
No branches or pull requests
We are using Rails 6.1 and
ActiveSupport::Cache::RedisStore
as the store and recently found that status keys are not expiring.The
expires_in
value is only specified when a job is enqueued, not for the other statuses: https://github.com/cdale77/active_job_status/blob/master/lib/active_job_status/job_tracker.rb#L11-L31It appears that when the status is updated, the expiration on the key is cleared. This may be behavior that has changed at some point.
It would be better to specify an
expires_in
value for all status updates to ensure that keys are cleaned up.We worked around this issue by configuring a default
expires_in
value for the store:Reproduction of the issuing using a console:
The text was updated successfully, but these errors were encountered: