javan/whenever

ActiveJob Enqueued but not performed

Closed this issue · 1 comments

ActiveJob Enqueued but not performed

when using perform_later but perform_now works fine !!!

// schedule.rb
env :PATH, ENV['PATH']
env :GEM_PATH, ENV['GEM_PATH']
set :output, "#{path}/log/cron_log.log"
set :environment, 'development'
job_type :runner, %Q{export PATH=/opt/rbenv/shims:/opt/rbenv/bin:/usr/bin:$PATH; eval "$(rbenv init -)";
cd :path && bundle exec rails runner -e :environment ':task' :output }

every 1.minutes do
runner "SyncLogsCleanupJob.perform_later"
end

// SyncLogsCleanupJob

class SyncLogsCleanupJob < ActiveJob::Base
queue_as :default
def perform(*args)
SyncLog.where('created_at < ?', 30.days.ago).each do |model|
model.destroy
end
end
end

// development.log

[ActiveJob] Enqueued SyncLogsCleanupJob (Job ID: 6260f260-513b-4fa3-920b-824e6f69f136) to Async(default)
[ActiveJob] Enqueued SyncLogsCleanupJob (Job ID: 423d49ae-4648-42e6-a7cd-046454b4f588) to Async(default)
[ActiveJob] Enqueued SyncLogsCleanupJob (Job ID: 0a33aef1-0888-4d09-8c6b-fb294ce9369b) to Async(default)
[ActiveJob] Enqueued SyncLogsCleanupJob (Job ID: 000cf282-3e76-4bbc-af41-43d875eaca96) to Async(default)

This is not a problem with Whenever.

If you’re using the in-memory backend, you must swap it out for something else.