How best to queue a long-running job

How exactly are you running the job? Can you paste the relevant part of the ruby code ?