2018-02-25 05:16:11 +11:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class SidekiqErrorHandler
|
|
|
|
def call(*)
|
|
|
|
yield
|
2019-07-02 09:01:17 +10:00
|
|
|
rescue Mastodon::HostValidationError
|
2018-02-25 05:16:11 +11:00
|
|
|
# Do not retry
|
2019-07-02 09:01:17 +10:00
|
|
|
ensure
|
|
|
|
socket = Thread.current[:statsd_socket]
|
|
|
|
socket&.close
|
|
|
|
Thread.current[:statsd_socket] = nil
|
2018-02-25 05:16:11 +11:00
|
|
|
end
|
|
|
|
end
|