about summary refs log tree commit diff
path: root/app/lib/sidekiq_error_handler.rb
blob: 8eb6b942dba17302880dcb87fd490652e14bc813 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

class SidekiqErrorHandler
  def call(*)
    yield
  rescue Mastodon::HostValidationError
    # Do not retry
  ensure
    socket = Thread.current[:statsd_socket]
    socket&.close
    Thread.current[:statsd_socket] = nil
  end
end