Onichan
Onichan

Reputation: 4516

Does Rails Sleep() use concurrent connection?

If our rails app is deployed to heroku and we use sleep(2.minutes) to queue a task, does this hog a connection or memory or something else?

I'm asking because heroku has limitations on concurrent connections. What if 25 users call the sleep(2.minutes) method, would this use up 25 concurrent connections for the next 2 minutes?

Upvotes: 0

Views: 329

Answers (1)

Max Dignan
Max Dignan

Reputation: 119

I'd suggest to look into using an ActiveJob to queue this task. Check out Resque or Sidekiq. Also check out http://guides.rubyonrails.org/active_job_basics.html. This will be a more "Rails" way of doing it.

Try YourJob.set(wait: 2.minutes).perform_later()

Upvotes: 1

Related Questions