afomera / MessageMe

tmsg - make group messaging better.
http://tmsg.io
0 stars 0 forks source link

Reduce cronjob delay for scheduled messages. #6

Closed afomera closed 8 years ago

afomera commented 8 years ago

After leaving it running on the production server, things appear okay to reduce the time from 5 minutes to every minute. Jobs are usually completed rather quickly.

Could be even quicker in the rake task I believe if we schedule the SMS message in a background job.

nynhex commented 8 years ago

Passing the message object to the sms job worker will reduce page load times significantly.

Also, now is a good time to look at clockwork. A rake task preloads the rails environment which is slower. Clockwork just fires the sucker_punch job at whatever increment you specify. It won't load the entire rails environment since it's already loaded in a thread. It'll trigger the job, perform the work, exit cleanly.

Be grateful you're not on celluloid.

afomera commented 8 years ago

The downside to using Clockwork from what I can tell is I have to start the clockwork process for the jobs to run. I didn't see any easy way to hook into that when I deploy with Capistrano. Did I overlook something?

Right now using whenever it has a tie in for Capistrano when I deploy it adds the cronjobs for me.

It's also one of the reasons I go with sucker_punch, I'm failing to grasp how to fit in something like sidekiq into the deployment side of things.