Jonathan Chan Jonathan Chan - 1 year ago 148
Ruby Question

Rails 5 - Resque not processing enqueued job

I'm trying to do enqueue a simple job using

1.26.0 (and
3.3.1). The job doesn't seem to be processing the
function because
is processing each job and shows 0 failures. The jobs also are being processed instantly.

The jobs are enqueued from a controller action with

Resque.enqueue(TestJob, url)

The job itself looks like

class TestJob < ApplicationJob
@queue = :tags_queue"log/resque_worker_QUEUE.log").fatal("thing")

def self.perform(url)"log/resque_worker_QUEUE.log").fatal("other thing")
logger.fatal("more errors please")

myDivideByZeroVar= 1/0
raise "error""log/resque_worker_QUEUE.log").fatal("other thing")
logger.fatal("more errors please")

A rake task is also set up:

require 'resque/tasks'
task "resque:setup" => :environment

is running.

The worker is started with
rake resque:work QUEUE=*
. Using verbose logging doesn't show anything useful.

The log file only shows the first fatal error string "thing". None of the other errors are logged that are inside

What am I doing wrong here?

Answer Source

Solved this. The job needed to be called using ActiveJob instead of using Resque.enqueue. TestJob.perform_later(url) worked just fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download