Question

I have an application where I want to automatically deactivate a user 72 hours after they have been activated. I have set this up with Delayed Job, but am now wondering if that is the best option.

My question is, if I set a task for 72 hours in the future, will a worker be active for that entire 72 hours? (I'm concerned about this as Heroku charges by the hour)

I'm open to suggestion here as far as better ways of doing this goes. One idea I had was to set this up using an exp_date column and check against that at sign in there by eliminating the need for DJ completely.

Was it helpful?

Solution

My question is, if I set a task for 72 hours in the future, will a worker be active for that entire 72 hours? (I'm concerned about this as Heroku charges by the hour)

Yes, it will be up all time. Delayed job continuously pings the database to see if there any job in its queue.

And, regarding the best option i think i rather put one column knows as valid_upto and put the date till will be active. I only signins (or whatever) to only those user which has created_at dates less then or equal to valid_upto date. And, periodically may be once in month i will run one cron job to remove invalid users.

And, like @leesungchul suggested, you can use that, that looks cool.

OTHER TIPS

You can use the workless gem which is an addon for delayed jobs so you don't leave your worker running constantly on heroku.

https://github.com/lostboy/workless

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top