I’ve recently integrated Redis and Sidekiq into a Rails template application but haven’t executed any jobs yet. Surprisingly, Sidekiq seems to be generating a large number of commands, quickly reaching the maximum limit set by my Redis provider, Upstash. The error message I’m encountering is as follows:
nrt [info] 2024-01-31T13:50:31.762Z pid=305 tid=d3x ERROR: ERR max daily request limit exceeded. Limit: 10000, Usage: 10000. See https://upstash.com/docs/redis/troubleshooting/max_daily_request_limit for details
To configure my application, I’ve added the following settings to my fly.toml
- fly.toml
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
[processes]
app = "bin/rails server"
worker = "bundle exec sidekiq"
I’ve also installed the sidekiq
gem and added the necessary configurations:
- application.rb
config.active_job.queue_adapter = :sidekiq
- config/initializers/sidekiq.rb
Sidekiq.configure_client do |config|
config.redis = { url: ENV['REDIS_URL'] }
end
Sidekiq.configure_server do |config|
config.redis = { url: ENV['REDIS_URL'] }
end
- route.rb
require 'sidekiq/web'
Sidekiq::Web.use ActionDispatch::Cookies
Sidekiq::Web.use Rails.application.config.session_store, Rails.application.config.session_options
Rails.application.routes.draw do
mount Sidekiq::Web, at: '/sidekiq'
Sidekiq::Web.use(Rack::Auth::Basic) do |user, password|
[user, password] == [ENV['SIDEKIQ_USERNAME'], ENV['SIDEKIQ_PASSWORD']]
end
end
Despite not having triggered any Sidekiq jobs, the Redis command limit is quickly reached. Could there be any default or background processes in Sidekiq or Rails that might be causing this issue? How can I investigate and resolve this to prevent hitting the limit without actual job processing?
Any insights or suggestions from the community would be greatly appreciated.