5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-06-02 17:24:16 +00:00
panel/app/jobs/application_job.rb

25 lines
586 B
Ruby
Raw Normal View History

2019-03-26 15:32:20 +00:00
# frozen_string_literal: true
2019-09-16 16:44:29 +00:00
# Base para trabajos
2018-01-02 17:19:25 +00:00
class ApplicationJob < ActiveJob::Base
include Que::ActiveJob::JobExtensions
2020-05-30 19:43:25 +00:00
# Esperar una cantidad random de segundos primos, para que no se
# superpongan tareas
#
# @return [Array<Integer>]
2024-05-02 19:05:35 +00:00
RANDOM_WAIT = [3, 5, 7, 11, 13].freeze
# @return [ActiveSupport::Duration]
def self.random_wait
RANDOM_WAIT.sample.seconds
end
attr_reader :site
# Si falla por cualquier cosa informar y descartar
discard_on(Exception) do |job, error|
ExceptionNotifier.notify_exception(error, data: { job: job })
2020-05-30 19:43:25 +00:00
end
2018-01-02 17:19:25 +00:00
end