require 'sidekiq' require 'active_job' include Sidekiq::Worker module Forcast module Jobs module JobsWrapper class Repetitive < ActiveJob::Base sidekiq_options queue: 'sync_repetitive' def perform(callback,array,t,interval,unidad) vas = eval(callback) unidad = 'minutes' unless units.include?(unidad) i = interval || 1 t = (t/i).round || 1 t.times do |time| vas.perform_at(((time+1)*interval).send(unidad).from_now,array) end end def units return ['seconds','minutes','hours','days'] end end end end end