Skip to content

Commit

Permalink
Add logging for Rails cache timeouts (#21667)
Browse files Browse the repository at this point in the history
* Reduce redis cache store connect timeout from default 20 seconds to 5 seconds

* Log cache store errors
  • Loading branch information
ClearlyClaire committed Nov 27, 2022
1 parent 14e2354 commit d587a26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/initializers/cache_logging.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Log cache errors with Rail's logger
# This used to be the default in old Rails versions: https://github.com/rails/rails/commit/7fcf8590e788cef8b64cc266f75931c418902ca9#diff-f0748f0be8a653eea13369ebb1cadabcad71ede7cfaf20282447e64329817befL86
Rails.cache.logger = Rails.logger
1 change: 1 addition & 0 deletions lib/mastodon/redis_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def setup_redis_env_url(prefix = nil, defaults = true)
namespace: cache_namespace,
pool_size: Sidekiq.server? ? Sidekiq.options[:concurrency] : Integer(ENV['MAX_THREADS'] || 5),
pool_timeout: 5,
connect_timeout: 5,
}.freeze

REDIS_SIDEKIQ_PARAMS = {
Expand Down

0 comments on commit d587a26

Please sign in to comment.