class Sidekiq::CurrentAttributes::Load

def wrap(klass_attrs, &block)

def wrap(klass_attrs, &block)
  klass, attrs = klass_attrs.shift
  return block.call unless klass
  retried = false
  begin
    set_succeeded = false
    klass.set(attrs) do
      set_succeeded = true
      wrap(klass_attrs, &block)
    end
  rescue NoMethodError
    # Don't retry if the no method error didn't come from current attributes
    raise if retried || set_succeeded
    # It is possible that the `CurrentAttributes` definition
    # was changed before the job started processing.
    attrs = attrs.select { |attr| klass.respond_to?(attr) }
    retried = true
    retry
  end
end