Class: BotVerification::RefreshJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/bot_verification/refresh_job.rb

Overview

Background job for refreshing bot IP ranges

Can be used directly or subclassed for customization:

Examples:

Direct usage with Sidekiq

BotVerification::RefreshJob.perform_async
BotVerification::RefreshJob.perform_async("google")

Direct usage with ActiveJob

BotVerification::RefreshJob.perform_later
BotVerification::RefreshJob.perform_later("openai_gptbot")

Subclass for custom queue or error handling

class RefreshBotIpRangesJob < BotVerification::RefreshJob
  queue_as :low

  def perform(bot_type = nil)
    super
  rescue => e
    Airbrake.notify(e)
    raise
  end
end

Instance Method Summary collapse

Instance Method Details

#perform(bot_type = nil) ⇒ Object

Parameters:

  • (defaults to: nil)

    Specific bot type to refresh, or nil for all



32
33
34
# File 'lib/bot_verification/refresh_job.rb', line 32

def perform(bot_type = nil)
  BotVerification.refresh_ip_ranges!(bot_type)
end