Sha256: baa53d2a5e37a613f73491e7d5c902bf3f78f4bc653798d4d161f97dd35bd2da

Contents?: true

Size: 692 Bytes

Versions: 4

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

require "active_job"
require "flipper/notifications/webhooks/errors"

module Flipper
  module Notifications
    class WebhookNotificationJob < ActiveJob::Base

      def self.disable_sidekiq_retries
        sidekiq_options(retry: 0) if respond_to?(:sidekiq_options)
      end

      # TODO: Pull queue from configuration?
      # queue_as :low

      retry_on Webhooks::NetworkError,
               Webhooks::ServerError,
               attempts: 3,
               wait:     ActiveJob.version < "7.1" ? :exponentially_longer : :polynomially_longer

      def perform(webhook:, **webhook_args)
        webhook.notify(**webhook_args)
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flipper-notifications-0.1.6 lib/flipper/notifications/jobs/webhook_notification_job.rb
flipper-notifications-0.1.5 lib/flipper/notifications/jobs/webhook_notification_job.rb
flipper-notifications-0.1.4 lib/flipper/notifications/jobs/webhook_notification_job.rb
flipper-notifications-0.1.3 lib/flipper/notifications/jobs/webhook_notification_job.rb