-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2273 from sul-dlss/redis_pool
Adds connection pool for redis. Increases timeout for redis.
- Loading branch information
Showing
6 changed files
with
19 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
pool_size = ENV.fetch('RAILS_MAX_THREADS', 5) | ||
|
||
REDIS = ConnectionPool.new(size: pool_size) do | ||
Redis.new(url: Settings.redis_url, timeout: Settings.redis_timeout) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
# See separate initializer for redis used by unique job. | ||
|
||
# Note the increased timeouts to try to address Redis timeouts | ||
Sidekiq.configure_server do |config| | ||
config.redis = { url: Settings.redis_url } | ||
config.redis = { url: Settings.redis_url, network_timeout: Settings.redis_timeout, pool_timeout: Settings.redis_timeout } | ||
# For Sidekiq Pro | ||
config.super_fetch! | ||
end | ||
|
||
Sidekiq.configure_client do |config| | ||
config.redis = { url: Settings.redis_url } | ||
config.redis = { url: Settings.redis_url, network_timeout: Settings.redis_timeout, pool_timeout: Settings.redis_timeout } | ||
end | ||
Sidekiq::Client.reliable_push! unless Rails.env.test? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters