Configure Sidekiq
Create job for cleaning up party previews
This commit is contained in:
parent
8da912a2e4
commit
2979ffb1e5
2 changed files with 11 additions and 8 deletions
|
|
@ -1,14 +1,12 @@
|
|||
# Fetch environment variables with defaults if not set
|
||||
redis_url = ENV.fetch('REDIS_URL', 'redis://localhost')
|
||||
redis_port = ENV.fetch('REDISPORT', '6379')
|
||||
|
||||
# Combine URL and port (adjust the path/DB as needed)
|
||||
full_redis_url = "#{redis_url}/0"
|
||||
redis_url = ENV.fetch('REDIS_URL', 'redis://localhost:6379/0')
|
||||
|
||||
Sidekiq.configure_server do |config|
|
||||
config.redis = { url: full_redis_url }
|
||||
config.redis = { url: redis_url }
|
||||
config.death_handlers << ->(job, ex) do
|
||||
Rails.logger.error("Preview generation job #{job['jid']} failed with: #{ex.message}")
|
||||
end
|
||||
end
|
||||
|
||||
Sidekiq.configure_client do |config|
|
||||
config.redis = { url: full_redis_url }
|
||||
config.redis = { url: redis_url }
|
||||
end
|
||||
|
|
|
|||
5
config/sidekiq.yml
Normal file
5
config/sidekiq.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
:scheduler:
|
||||
cleanup_party_previews:
|
||||
cron: '0 0 * * *' # Daily at midnight
|
||||
class: CleanupPartyPreviewsJob
|
||||
queue: maintenance
|
||||
Loading…
Reference in a new issue