Thanks a lot for the answer.

I've installed new relic gold in order to see more debug information,
but I'll try the new logging system as well, thank you!

Studying the problem today, I've decided to separate parts of the
weight process (first step, separate a S3 upload). So, I've decided to
try delayed_job, I've tried some of the sources I found and I think I
understand the process: I create a background job in order to not
block the dynos, because the error we had been obtaining was "request
timeout", more than 30 secs in the response
http://docs.heroku.com/performance#request-timeout.

I'm wanting to use collectiveidea gem, following
https://github.com/collectiveidea/delayed_job/. I understand the
process, but I can't enqueue the task... Btw, does heroku recommends
to use delayed_job as a plugin as in
http://docs.heroku.com/delayed-job or can I use the previous gem from
collectiveidea?

Now, the main question, I'll write some chunks of code to illustrate:

class SaleDeliverable < ActiveRecord::Base{
...
before_validation(:on => :create) { generate_pdf_attachment }
...
def generate_pdf_attachment
puts "HERE I AM....JUST LOGGING..."
p = ProductReport.new(sale)
@generated_report_file = StringIO.new(p.to_pdf)
@generated_report_file.original_filename = pdf_filename
self.attachment = CarrierWave::SanitizedFile.new(@generated_report_file)
end
handle_asynchronously :generate_pdf_attachment
...
end

The code works perfectly without the handle_asynchronously statement.
Now, when I add this line, the process continues, creates the
deliverable and the rest of the business logic, but that method is
never called (never logged the message in the console). Also I've
tried with a custom job, but the same. Also I've tried with the delay
method, but the same.

Even I've tried the plugin, following Ryan Bates' tutorial, using
send_later instead of delay method, but the same. It passes the method
completely and follows, and it seems as if no job was sent to the
queue...

In local, I've tried to start the workers for the queue with rake
jobs:work and also with script/delayed_job start, but no input here...
Even I've been watching the delayed_jobs table from console
(Delayed::Job.all), but there's nothing there always. In heroku I've
also tried (with 1 worker installed), but same results...

It's strange because in the console I can see this sql, as if the job
was ready to be inserted in the table, but no visible error:

INSERT INTO "delayed_jobs" ("attempts", "created_at", "failed_at",
"handler", "last_error", "locked_at", "locked_by", "priority",
"run_at", "updated_at") VALUES (0, '2010-11-17 00:57:11.132341', NULL,
'--- !ruby/struct:Delayed::PerformableMethod
object: !ruby/ActiveRecord:SaleDeliverable
attributes:
created_at:
sale_id: 2112
updated_at:
notes:
attachment:
contract_data:
user_id: 479
method_name: :generate_pdf_attachment_without_delay
args: []
', NULL, NULL, NULL, 0, '2010-11-17 00:57:11.132203', '2010-11-17
00:57:11.132341')

So, the problem is that I don't know how to see if the job has been
sent correctly to the queue, or where it is being sent...

Any ideas would be highly appreciated.

Kind regards.

Josal

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to