mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Refactor Sidekiq settings and set expiry in development
This means old cache entries will be automatically removed instead of perpetually filling up the local Redis instance in dev.
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
redis_jobs_url = ENV.fetch("OFN_REDIS_JOBS_URL", "redis://localhost:6381/0")
|
||||
# Redis connection configuration for Sidekiq
|
||||
|
||||
redis_connection_settings = {
|
||||
url: ENV.fetch("OFN_REDIS_JOBS_URL", "redis://localhost:6381/0"),
|
||||
network_timeout: 5,
|
||||
expires_in: Rails.env.development? ? 90.minutes : nil
|
||||
}
|
||||
|
||||
Sidekiq.configure_server do |config|
|
||||
config.redis = { url: redis_jobs_url, network_timeout: 5 }
|
||||
config.redis = redis_connection_settings
|
||||
end
|
||||
|
||||
Sidekiq.configure_client do |config|
|
||||
config.redis = { url: redis_jobs_url, network_timeout: 5 }
|
||||
config.redis = redis_connection_settings
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user