rookieruby
rookieruby

Reputation: 113

Delayed job for pdfkit middlware

I am using pdfkit middleware on Heroku to generate pdf. How can i make pdf generating thing as a background job.

def index

    @products = Product.all

    respond_to do |format|
      format.html
      format.pdf 
    end  

end

Upvotes: 2

Views: 430

Answers (2)

John Beynon
John Beynon

Reputation: 37507

It's not so simple what the other answers are suggesting in fact.

Implementing delayed job for PDF generation is all well and good. But you have more things to consider - you pass the process over to DJ and the end result is a PDF is generated. But you have to then get that PDF back infront of the user - either by polling the job for when it completes and then providing a link to the pdf possibly, or sending them an email to collect the PDF.

Upvotes: 1

Anatoly
Anatoly

Reputation: 15530

try HireFire The Heroku Worker Manager. it will use Delayed Job and Resque workers on Heroku

Upvotes: 0

Related Questions