DEV: Upgrade Sidekiq to 6.5 (#17142)

This commit is contained in:
Alan Guo Xiang Tan 2022-06-21 09:23:36 +08:00 committed by GitHub
parent 54a518b21d
commit 3562c598ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 11 deletions

View File

@ -450,7 +450,7 @@ GEM
activesupport (>= 3.1) activesupport (>= 3.1)
shoulda-matchers (5.1.0) shoulda-matchers (5.1.0)
activesupport (>= 5.2.0) activesupport (>= 5.2.0)
sidekiq (6.4.2) sidekiq (6.5.1)
connection_pool (>= 2.2.2) connection_pool (>= 2.2.2)
rack (~> 2.0) rack (~> 2.0)
redis (>= 4.2.0) redis (>= 4.2.0)
@ -637,4 +637,4 @@ DEPENDENCIES
yaml-lint yaml-lint
BUNDLED WITH BUNDLED WITH
2.3.13 2.3.16

View File

@ -9,11 +9,6 @@ module Discourse
DB_POST_MIGRATE_PATH ||= "db/post_migrate" DB_POST_MIGRATE_PATH ||= "db/post_migrate"
REQUESTED_HOSTNAME ||= "REQUESTED_HOSTNAME" REQUESTED_HOSTNAME ||= "REQUESTED_HOSTNAME"
require 'sidekiq/exception_handler'
class SidekiqExceptionHandler
extend Sidekiq::ExceptionHandler
end
class Utils class Utils
URI_REGEXP ||= URI.regexp(%w{http https}) URI_REGEXP ||= URI.regexp(%w{http https})
@ -168,7 +163,7 @@ module Discourse
return if ex.class == Jobs::HandledExceptionWrapper return if ex.class == Jobs::HandledExceptionWrapper
context ||= {} context ||= {}
parent_logger ||= SidekiqExceptionHandler parent_logger ||= Sidekiq
cm = RailsMultisite::ConnectionManagement cm = RailsMultisite::ConnectionManagement
parent_logger.handle_exception(ex, { parent_logger.handle_exception(ex, {

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class SidekiqLogsterReporter < Sidekiq::ExceptionHandler::Logger class SidekiqLogsterReporter
def call(ex, context = {}) def call(ex, context = {})
return if Jobs::HandledExceptionWrapper === ex return if Jobs::HandledExceptionWrapper === ex

View File

@ -321,8 +321,9 @@ describe Discourse do
context "#handle_exception" do context "#handle_exception" do
class TempSidekiqLogger < Sidekiq::ExceptionHandler::Logger class TempSidekiqLogger
attr_accessor :exception, :context attr_accessor :exception, :context
def call(ex, ctx) def call(ex, ctx)
self.exception = ex self.exception = ex
self.context = ctx self.context = ctx
@ -332,10 +333,13 @@ describe Discourse do
let!(:logger) { TempSidekiqLogger.new } let!(:logger) { TempSidekiqLogger.new }
before do before do
Sidekiq.error_handlers.clear
Sidekiq.error_handlers << logger Sidekiq.error_handlers << logger
end end
after do
Sidekiq.error_handlers.delete(logger)
end
it "should not fail when called" do it "should not fail when called" do
exception = StandardError.new exception = StandardError.new