Skip to content
Extraits de code Groupes Projets
Valider 62bb4dc7 rédigé par Jonne Haß's avatar Jonne Haß
Parcourir les fichiers

Update to Sidekiq 6

closes #8153
closes #8162
parent f52dbe57
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -37,12 +37,12 @@ gem "simple_captcha2", "0.5.0", require: "simple_captcha" ...@@ -37,12 +37,12 @@ gem "simple_captcha2", "0.5.0", require: "simple_captcha"
# Background processing # Background processing
gem "redis", "3.3.5" # Pinned to 3.3.x because of https://github.com/antirez/redis/issues/4272 gem "redis", "4.2.5"
gem "sidekiq", "5.2.8" gem "sidekiq", "6.2.1"
# Scheduled processing # Scheduled processing
gem "sidekiq-cron", "1.1.0" gem "sidekiq-cron", "1.2.0"
# Compression # Compression
......
...@@ -138,7 +138,7 @@ GEM ...@@ -138,7 +138,7 @@ GEM
sprockets (< 4.0) sprockets (< 4.0)
concurrent-ruby (1.1.6) concurrent-ruby (1.1.6)
configurate (0.5.0) configurate (0.5.0)
connection_pool (2.2.2) connection_pool (2.2.3)
crack (0.4.3) crack (0.4.3)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
crass (1.0.6) crass (1.0.6)
...@@ -261,9 +261,9 @@ GEM ...@@ -261,9 +261,9 @@ GEM
fog-core fog-core
nokogiri (>= 1.5.11, < 2.0.0) nokogiri (>= 1.5.11, < 2.0.0)
formatador (0.2.5) formatador (0.2.5)
fugit (1.3.3) fugit (1.4.4)
et-orbi (~> 1.1, >= 1.1.8) et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.1) raabro (~> 1.4)
fuubar (2.5.0) fuubar (2.5.0)
rspec-core (~> 3.0) rspec-core (~> 3.0)
ruby-progressbar (~> 1.4) ruby-progressbar (~> 1.4)
...@@ -498,8 +498,8 @@ GEM ...@@ -498,8 +498,8 @@ GEM
byebug (~> 11.0) byebug (~> 11.0)
pry (~> 0.10) pry (~> 0.10)
public_suffix (4.0.3) public_suffix (4.0.3)
raabro (1.1.6) raabro (1.4.0)
rack (2.0.9) rack (2.2.3)
rack-cors (1.1.1) rack-cors (1.1.1)
rack (>= 2.0.0) rack (>= 2.0.0)
rack-google-analytics (1.2.0) rack-google-analytics (1.2.0)
...@@ -514,8 +514,6 @@ GEM ...@@ -514,8 +514,6 @@ GEM
json-jwt (>= 1.11.0) json-jwt (>= 1.11.0)
rack rack
rack-piwik (0.3.0) rack-piwik (0.3.0)
rack-protection (2.0.8.1)
rack
rack-rewrite (1.5.1) rack-rewrite (1.5.1)
rack-ssl (1.4.1) rack-ssl (1.4.1)
rack rack
...@@ -608,7 +606,7 @@ GEM ...@@ -608,7 +606,7 @@ GEM
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
redcarpet (3.5.0) redcarpet (3.5.0)
redis (3.3.5) redis (4.2.5)
regexp_parser (1.7.0) regexp_parser (1.7.0)
request_store (1.5.0) request_store (1.5.0)
rack (>= 1.4) rack (>= 1.4)
...@@ -678,12 +676,11 @@ GEM ...@@ -678,12 +676,11 @@ GEM
shellany (0.0.1) shellany (0.0.1)
shoulda-matchers (4.0.1) shoulda-matchers (4.0.1)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
sidekiq (5.2.8) sidekiq (6.2.1)
connection_pool (~> 2.2, >= 2.2.2) connection_pool (>= 2.2.2)
rack (< 2.1.0) rack (~> 2.0)
rack-protection (>= 1.5.0) redis (>= 4.2.0)
redis (>= 3.3.5, < 5) sidekiq-cron (1.2.0)
sidekiq-cron (1.1.0)
fugit (~> 1.1) fugit (~> 1.1)
sidekiq (>= 4.2.1) sidekiq (>= 4.2.1)
simple_captcha2 (0.5.0) simple_captcha2 (0.5.0)
...@@ -738,7 +735,7 @@ GEM ...@@ -738,7 +735,7 @@ GEM
unf (~> 0.1.0) unf (~> 0.1.0)
typhoeus (1.4.0) typhoeus (1.4.0)
ethon (>= 0.9.0) ethon (>= 0.9.0)
tzinfo (1.2.7) tzinfo (1.2.9)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.2.0) uglifier (4.2.0)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
...@@ -894,7 +891,7 @@ DEPENDENCIES ...@@ -894,7 +891,7 @@ DEPENDENCIES
rb-fsevent (= 0.10.3) rb-fsevent (= 0.10.3)
rb-inotify (= 0.10.1) rb-inotify (= 0.10.1)
redcarpet (= 3.5.0) redcarpet (= 3.5.0)
redis (= 3.3.5) redis (= 4.2.5)
responders (= 3.0.1) responders (= 3.0.1)
rqrcode (= 1.1.2) rqrcode (= 1.1.2)
rspec-json_expectations (~> 2.1) rspec-json_expectations (~> 2.1)
...@@ -906,8 +903,8 @@ DEPENDENCIES ...@@ -906,8 +903,8 @@ DEPENDENCIES
sass-rails (= 5.0.7) sass-rails (= 5.0.7)
secure_headers (= 6.3.2) secure_headers (= 6.3.2)
shoulda-matchers (= 4.0.1) shoulda-matchers (= 4.0.1)
sidekiq (= 5.2.8) sidekiq (= 6.2.1)
sidekiq-cron (= 1.1.0) sidekiq-cron (= 1.2.0)
simple_captcha2 (= 0.5.0) simple_captcha2 (= 0.5.0)
simplecov (= 0.16.1) simplecov (= 0.16.1)
sinon-rails (= 1.15.0) sinon-rails (= 1.15.0)
......
# frozen_string_literal: true # frozen_string_literal: true
require 'sidekiq_middlewares' require "sidekiq_middlewares"
require 'sidekiq/middleware/i18n' require "sidekiq/middleware/i18n"
# Single process-mode # Single process-mode
if AppConfig.environment.single_process_mode? && Rails.env != "test" if AppConfig.environment.single_process_mode? && !Rails.env.test?
if Rails.env == 'production' if Rails.env.production?
warn "WARNING: You are running Diaspora in production without Sidekiq" warn "WARNING: You are running Diaspora in production without Sidekiq"
warn " workers turned on. Please set single_process_mode to false in" warn " workers turned on. Please set single_process_mode to false in"
warn " config/diaspora.toml." warn " config/diaspora.toml."
end end
require 'sidekiq/testing/inline' require "sidekiq/testing/inline"
end end
Sidekiq.configure_server do |config| Sidekiq.configure_server do |config|
...@@ -20,35 +20,15 @@ Sidekiq.configure_server do |config| ...@@ -20,35 +20,15 @@ Sidekiq.configure_server do |config|
chain.add SidekiqMiddlewares::CleanAndShortBacktraces chain.add SidekiqMiddlewares::CleanAndShortBacktraces
end end
# Set connection pool on Heroku # Set connection pool to match concurrency
database_url = ENV['DATABASE_URL'] database_url = ENV["DATABASE_URL"]
if(database_url) if database_url
ENV['DATABASE_URL'] = "#{database_url}?pool=#{AppConfig.environment.sidekiq.concurrency.get}" ENV["DATABASE_URL"] = "#{database_url}?pool=#{AppConfig.environment.sidekiq.concurrency.get}"
ActiveRecord::Base.establish_connection ActiveRecord::Base.establish_connection
end end
# Make sure each Sidekiq process has its own sequence of UUIDs # Make sure each Sidekiq process has its own sequence of UUIDs
UUID.generator.next_sequence UUID.generator.next_sequence
# wrap the logger to add the sidekiq job context to the log
class SidekiqLogger < SimpleDelegator
SPACE = " "
# only info is used with context
def info(data=nil)
return false if Logger::Severity::INFO < level
data = yield if data.nil? && block_given?
__getobj__.info("#{context}#{data}")
end
# from sidekiq/logging.rb
def context
c = Thread.current[:sidekiq_context]
"#{c.join(SPACE)}: " if c && c.any?
end
end
Sidekiq::Logging.logger = SidekiqLogger.new(Logging.logger[Sidekiq])
end end
Sidekiq.configure_client do |config| Sidekiq.configure_client do |config|
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter