Rails development environment Resque.enqueue does not create jobs
Posted
by
anton evangelatov
on Stack Overflow
See other posts from Stack Overflow
or by anton evangelatov
Published on 2013-06-25T14:15:19Z
Indexed on
2013/06/26
22:21 UTC
Read the original article
Hit count: 250
I am having the same problem like Rails custom environment Resque.enqueue does not create jobs , but the solution there doesn't work for me.
I'm using Resque
for a couple of asynchronous jobs. It works just fine for the staging
environment, but for some reason it stopped working on development
environment.
For example, if I run the following:
$ rails c development
> Resque.enqueue(MyLovelyJob, 1)
Nothing is enqueued. I check Resque using resque-web
If I run it on staging - it works just fine.
$ rails c staging
> Resque.enqueue(MyLovelyJob, 1)
I have tried to duplicate the 2 environment, and they seem to use absolutely the same configurations (database.yml , config/environment , etc.), but development
is still not working.
If I do
> Resque.enqueue(UpdateInstancesData, 2)
> => true
> Resque.info
> => {
> :pending => 0,
> :processed => 0,
> :queues => 0,
> :workers => 1,
> :working => 0,
> :failed => 0,
> :servers => [
> [0] "redis://127.0.0.1:6379/0"
> ],
> :environment => "development"
> }
Any suggestions where to look in order to debug this?
I am running the application via foreman. My Procfile looks like:
faye: rackup faye.ru -s thin -E production
worker1: bundle exec rake resque:work QUEUE=* VERBOSE=1
worker2: bundle exec rake resque:work QUEUE=* VERBOSE=1
clock: bundle exec rake resque:scheduler VERBOSE=1
web: bundle exec rails s
For staging
, as mentioned, everything works and the log from foreman is:
17:03:42 clock.1 | 2013-06-26 17:03:42 Reloading Schedule
17:03:42 clock.1 | 2013-06-26 17:03:42 Loading Schedule
17:03:42 clock.1 | 2013-06-26 17:03:42 Scheduling logging_test
17:03:42 clock.1 | 2013-06-26 17:03:42 Schedules Loaded
17:03:43 worker2.1 | *** Starting worker ttttt-mbp.local:69573:*
17:03:43 worker2.1 | *** Registered signals
17:03:43 worker2.1 | *** Running before_first_fork hooks
17:03:43 worker1.1 | *** Starting worker ttttt-mbp.local:69572:*
17:03:43 worker1.1 | *** Registered signals
17:03:43 worker2.1 | *** Checking another_queue
17:03:43 worker2.1 | *** Checking anotherqueue
17:03:43 worker2.1 | *** Checking statused
17:03:43 worker2.1 | *** Found job on statused
17:03:43 worker2.1 | *** got: (Job{statused} | LoggingTest | ["57e89a1c1b24ce6866bcf5d0e1c07f01", {}])
17:06:30 clock.1 | 2013-06-26 17:06:30 queueing LoggingTest (logging_test)
17:06:33 worker1.1 | *** Checking another_queue
17:06:33 worker2.1 | *** Checking another_queue
17:06:33 worker1.1 | *** Checking anotherqueue
17:06:33 worker2.1 | *** Checking anotherqueue
17:06:33 worker1.1 | *** Found job on anotherqueue
17:06:33 worker1.1 | *** got: (Job{anotherqueue} | LoggingTest | ["0d976869a945766e0cfeca83e7349305", {}])
17:06:33 worker1.1 | *** resque-1.24.1: Processing anotherqueue since 1372259193 [LoggingTest]
17:06:33 worker1.1 | *** Running before_fork hooks with [(Job{anotherqueue} | LoggingTest | ["0d976869a945766e0cfeca83e7349305", {}])]
17:06:33 worker1.1 | *** resque-1.24.1: Forked 69955 at 1372259193
17:06:33 worker2.1 | *** resque-1.24.1: Forked 69956 at 1372259193
17:06:33 worker1.1 | *** Running after_fork hooks with [(Job{anotherqueue} | LoggingTest | ["0d976869a945766e0cfeca83e7349305", {}])]
17:06:33 worker1.1 | JOB :: LoggingTest
17:06:33 worker1.1 | 55555
17:06:33 worker1.1 | *** done: (Job{anotherqueue} | LoggingTest | ["0d976869a945766e0cfeca83e7349305", {}])
whereas for development
it doesn't seem to enqueue and then find the job. If there is a job already in the queue (pending, left over from staging environment) the workers from development don't process it.
17:01:23 clock.1 | 2013-06-26 17:01:23 Reloading Schedule
17:01:23 clock.1 | 2013-06-26 17:01:23 Loading Schedule
17:01:23 clock.1 | 2013-06-26 17:01:23 Scheduling logging_test
17:01:23 clock.1 | 2013-06-26 17:01:23 Scheduling update_instances_data
17:01:23 clock.1 | 2013-06-26 17:01:23 Schedules Loaded
17:03:10 clock.1 | 2013-06-26 17:03:10 queueing LoggingTest (logging_test)
17:03:14 worker1.1 | *** Checking another_queue
17:03:14 worker2.1 | *** Checking another_queue
17:03:14 worker1.1 | *** Checking anotherqueue
17:03:14 worker2.1 | *** Checking anotherqueue
17:03:14 worker1.1 | *** Checking statused
17:03:14 worker2.1 | *** Checking statused
© Stack Overflow or respective owner