1

I've seen and understand the :after filter, but I don't even know the terms for what I'm trying to do. I've got a simple app using twilio and highrise logging calls. I'd like to return the twiml response via sinatra BEFORE posting to external API due to latency issues. Any suggestions?

I've seen similar questions but none dealing with ruby/sinatra. Thanks.

Matt Walston
  • 97
  • 1
  • 8
  • There was a gem for that, called *run_later*, but it stopped working for me due to some updated gems (half a year ago or so). Don't know why. Maybe you can try it or did you find another answer yet? – user562529 Mar 29 '13 at 21:11

1 Answers1

0

The delayed_job gem should do what you need. It allows you to schedule code to be executed in the future, e.g. after the HTTP response has been sent.

DJ is dependant on ActiveRecord (it needs a db table to store the jobs in) but you can get it running on Sinatra too: https://github.com/bmizerany/sinatra-dj

David Underwood
  • 4,908
  • 1
  • 19
  • 25