Perform a task in 15 minutes from now in Rails
jobs, ruby-on-rails, task
Solution
Have a status field in your ticket model(or whatever model you are using) and mark it as partially_booked when user selects it.
If you are using delayed jobs,
handle_asynchronously :your_method_here, :run_at => Proc.new { 15.minutes.from_now }
If you are using sidekiq,
YourWorker.perform_in(15.minutes, ticket_id)
where 'your_method_here' or 'YourWorker' will contain the logic to check if booking was completed or not, and mark it as unassigned if it was not completed.
Problem
I'm creating a Rails application that let users book tickets for an event. Once the user selects the ticket he wants to buy, he has 15 minutes to complete the checkout, otherwise the ticket will be released and can be booked by someone else. How can I "block" the ticket for 15 minutes and make it available again after 15 minutes?