diff --git a/Gemfile b/Gemfile index 5a5828660..9bd02be78 100644 --- a/Gemfile +++ b/Gemfile @@ -42,12 +42,12 @@ gem "simple_captcha2", "0.5.0", require: "simple_captcha" # Background processing -gem "redis", "4.7.0" -gem "sidekiq", "6.5.1" +gem "redis-client", "0.14.1" +gem "sidekiq", "7.1.2" # Scheduled processing -gem "sidekiq-cron", "1.6.0" +gem "sidekiq-cron", "1.10.1" # Compression diff --git a/Gemfile.lock b/Gemfile.lock index 0f15a2565..5bdd3b938 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -143,7 +143,7 @@ GEM coderay (1.1.3) concurrent-ruby (1.2.2) configurate (0.5.0) - connection_pool (2.2.5) + connection_pool (2.4.1) crack (0.4.5) rexml crass (1.0.6) @@ -311,7 +311,7 @@ GEM fog-core nokogiri (>= 1.5.11, < 2.0.0) formatador (1.1.0) - fugit (1.5.3) + fugit (1.8.1) et-orbi (~> 1, >= 1.2.7) raabro (~> 1.4) fuubar (2.5.1) @@ -602,7 +602,8 @@ GEM rb-inotify (0.10.1) ffi (~> 1.0) redcarpet (3.5.1) - redis (4.7.0) + redis-client (0.14.1) + connection_pool regexp_parser (2.8.1) request_store (1.5.1) rack (>= 1.4) @@ -676,13 +677,15 @@ GEM secure_headers (6.3.3) shoulda-matchers (4.5.1) activesupport (>= 4.2.0) - sidekiq (6.5.1) - connection_pool (>= 2.2.2) - rack (~> 2.0) - redis (>= 4.2.0) - sidekiq-cron (1.6.0) - fugit (~> 1) - sidekiq (>= 4.2.1) + sidekiq (7.1.2) + concurrent-ruby (< 2) + connection_pool (>= 2.3.0) + rack (>= 2.2.4) + redis-client (>= 0.14.0) + sidekiq-cron (1.10.1) + fugit (~> 1.8) + globalid (>= 1.0.1) + sidekiq (>= 6) simple_captcha2 (0.5.0) rails (>= 4.1) simple_oauth (0.3.1) @@ -869,7 +872,7 @@ DEPENDENCIES rails-i18n (= 6.0.0) rails-timeago (= 2.20.0) redcarpet (= 3.5.1) - redis (= 4.7.0) + redis-client (= 0.14.1) responders (= 3.1.0) rqrcode (= 2.2.0) rspec-json_expectations (~> 2.1) @@ -881,8 +884,8 @@ DEPENDENCIES sassc-rails (= 2.1.2) secure_headers (= 6.3.3) shoulda-matchers (= 4.5.1) - sidekiq (= 6.5.1) - sidekiq-cron (= 1.6.0) + sidekiq (= 7.1.2) + sidekiq-cron (= 1.10.1) simple_captcha2 (= 0.5.0) simplecov (= 0.21.2) sinon-rails (= 1.15.0) diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index c6a5f516c..65486642d 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -30,7 +30,7 @@ class InvitationsController < ApplicationController session[:invalid_email_invites] = invalid_emails unless valid_emails.empty? - Workers::Mail::InviteEmail.perform_async(valid_emails.join(","), current_user.id, inviter_params) + Workers::Mail::InviteEmail.perform_async(valid_emails.join(","), current_user.id, inviter_params.to_h) end if emails.empty? diff --git a/app/workers/archive_base.rb b/app/workers/archive_base.rb index 6b8b38a82..b6b2001e7 100644 --- a/app/workers/archive_base.rb +++ b/app/workers/archive_base.rb @@ -31,7 +31,7 @@ module Workers !(Process.pid.to_s == process_id.split(":")[1] && Thread.current.object_id.to_s(36) == thread_id) && ArchiveBase.subclasses.map(&:to_s).include?(work["payload"]["class"]) end - rescue Redis::CannotConnectError + rescue RedisClient::CannotConnectError # If code gets to this point and there is no Redis conenction, we're # running in a Test environment and have not mocked Sidekiq::Workers, so # we're not testing the concurrency-limiting behavior. diff --git a/script/server b/script/server index aee6cf4f5..af68b8f18 100755 --- a/script/server +++ b/script/server @@ -128,7 +128,8 @@ if [ -n "$redis_url" ] then redis_param="url: '$redis_url'" fi -if [ "$(bin/bundle exec ruby -e "require 'redis'; puts Redis.new($redis_param).ping" 2> /dev/null | grep -vE "is not writable|as your home directory temporarily" )" != "PONG" ] +echo $redis_param +if [ "$(bin/bundle exec ruby -e "require 'redis-client'; puts RedisClient.config($redis_param).new_client.call('PING')" 2> /dev/null | grep -vE "is not writable|as your home directory temporarily" )" != "PONG" ] then fatal "Can't connect to redis. Please check if it's running and if environment.redis is configured correctly in $CONFIG_FILE." fi diff --git a/spec/controllers/invitations_controller_spec.rb b/spec/controllers/invitations_controller_spec.rb index 87232f401..f7cf2dfc9 100644 --- a/spec/controllers/invitations_controller_spec.rb +++ b/spec/controllers/invitations_controller_spec.rb @@ -39,7 +39,7 @@ describe InvitationsController, type: :controller do it "creates an InviteEmail worker" do expect(Workers::Mail::InviteEmail).to receive(:perform_async).with( - emails, alice.id, invite_params[:email_inviter] + emails, alice.id, invite_params[:email_inviter].stringify_keys ) post :create, params: invite_params end @@ -85,7 +85,7 @@ describe InvitationsController, type: :controller do it "creates an InviteEmail worker" do expect(Workers::Mail::InviteEmail).to receive(:perform_async).with( - valid_emails, alice.id, invite_params[:email_inviter] + valid_emails, alice.id, invite_params[:email_inviter].stringify_keys ) post :create, params: invite_params end