ahoward / bj

Backgroundjob (Bj) is a brain dead simple, zero admin, background priority queue for Rails.
Other
31 stars 13 forks source link

Job is started twice from controller, please help #1

Open ghost opened 15 years ago

ghost commented 15 years ago

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

ambethia commented 15 years ago

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 commented 14 years ago

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

andy-frost commented 14 years ago

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