Sha256: e0e20d524ee15230d7ed06e3b8ce03fd2aa7ce09bec5e3501deaf199bd7fe88d
Contents?: true
Size: 1.19 KB
Versions: 42
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true module GoodJob # Shared methods for filtering Execution/Job records from the +good_jobs+ table. module ErrorEvents extend ActiveSupport::Concern ERROR_EVENTS = [ ERROR_EVENT_INTERRUPTED = 'interrupted', ERROR_EVENT_UNHANDLED = 'unhandled', ERROR_EVENT_HANDLED = 'handled', ERROR_EVENT_RETRIED = 'retried', ERROR_EVENT_RETRY_STOPPED = 'retry_stopped', ERROR_EVENT_DISCARDED = 'discarded', ].freeze ERROR_EVENT_ENUMS = { ERROR_EVENT_INTERRUPTED => 0, ERROR_EVENT_UNHANDLED => 1, ERROR_EVENT_HANDLED => 2, ERROR_EVENT_RETRIED => 3, ERROR_EVENT_RETRY_STOPPED => 4, ERROR_EVENT_DISCARDED => 5, }.freeze # TODO: GoodJob v4 can make this an `enum` once migrations are guaranteed. def error_event return unless self.class.columns_hash['error_event'] enum = super return unless enum ERROR_EVENT_ENUMS.key(enum) end def error_event=(event) return unless self.class.columns_hash['error_event'] enum = ERROR_EVENT_ENUMS[event] raise(ArgumentError, "Invalid error_event: #{event}") if event && !enum super(enum) end end end
Version data entries
42 entries across 42 versions & 1 rubygems