bj icon indicating copy to clipboard operation
bj copied to clipboard

Job is started twice from controller, please help

Open ghost opened this issue 16 years ago • 3 comments

Hi,

I am running a Rails 2.3.2 app on Phusion Passenger. In a controller, I start a Backgroundjob job. This job is a Rake task that sends an email through Action Mailer. I get the email twice which isn't intended. Looking at the Rails logs, I see the Rails action has only been hit once, but the database queries have been executed twice, with a delay of a few miliseconds . Looking at the Bj log, I see the job has only been executed once.

When I start the exact same rake task on the command line, I only get one email and the logs don't show doubled activity.

That is why I think it has something to do with Phusion Passenger? Maybe the job gets executed once for every instance / thread? The execution is only a few miliseconds apart.

I am not sure how to further debug this issue, or where to look for more info what might be wrong. Thank you for any help you can give me.

Ben

ghost avatar Aug 11 '09 20:08 ghost

I'm using webrick and it firing the jobs twice for me as well. It also fires twice if I submit the job via console.

35947 ttys000    0:01.87 /usr/local/bin/ruby18 /usr/local/bin/bj run --forever --redirect=/Users/jasper/Code/grays/warehouse/log/bj.Eve.local.development.log --ppid=35884 
35950 ttys000    0:05.41 ruby ./app/jobs/guide_processor 2
35951 ttys000    0:05.32 ruby ./app/jobs/guide_processor 2

The later one is the one bj is keeping track of: 35951

ambethia avatar Sep 17 '09 23:09 ambethia

Ben, if you haven't noticed yet, I've forked Bj here and fixed this issue: ambethia@1b63b757276e6ce4e46e524b46d798e2d440cc22

ambethia avatar Oct 13 '09 15:10 ambethia

hi is there any BJ that works with ruby 1.9 ??? i've tried gem and plugin with no luck!

andy-frost avatar Jan 26 '10 21:01 andy-frost