Search code examples
ruby-on-railsredisbraintreepayment-processing

Best way to schedule payment jobs in Rails


I want to schedule API calls to the Braintree API to process transactions x hours after the end date of an event.

I've been using Resque scheduler and Redis to queue up payment jobs for say, 24 hours after an end date.

To my knowledge, if my Redis server or Resque workers ever go offline, all the jobs are wiped, meaning the payment transactions will never go through.

Is this the proper way to handle these payment jobs, or should I instead have cron jobs do a nightly scanthrough of the database and run a payment job for a particular event if it's necessary?

It'd be preferable if payment processing happened at a fixed x amount of time after an event's end date, but running cron jobs nightly is fine too.


Solution

  • Why not ensure persistence in Redis? http://redis.io/topics/persistence