wa0x6e / Cake-Resque

Resque plugin for CakePHP : for creating background jobs that can be processed offline later
MIT License
159 stars 56 forks source link

Support Scheduled Jobs #15

Closed hongkongkiwi closed 11 years ago

hongkongkiwi commented 11 years ago

I've been using this framework for my Cake project and it works well!

However I'm really missing a feature some other systems resque systems have which is job scheduling.

For example, I would like to send newsletter emails using a job, so I've generated 50 jobs for 50 emails that are sent out. However I want to schedule these to get sent out at midnight.

Are you able to implement this into the code? Perhaps it's just an extra parameter to enqueue. The job has a time saved with it and the worker just checks to see if the time has passed, if not it leaves the job alone and checks the next job.

wa0x6e commented 11 years ago

Interresting feature that's on my todo list. I'm currently on a trip, I'll try to implement this when I'm back, in mid-january.

On Sunday, December 23, 2012, Andy wrote:

I've been using this framework for my Cake project and it works well!

However I'm really missing a feature some other systems resque systems have which is job scheduling.

For example, I would like to send newsletter emails using a job, so I've generated 50 jobs for 50 emails that are sent out. However I want to schedule these to get sent out at midnight.

Are you able to implement this into the code? Perhaps it's just an extra parameter to enqueue. The job has a time saved with it and the worker just checks to see if the time has passed, if not it leaves the job alone and checks the next job.

— Reply to this email directly or view it on GitHubhttps://github.com/kamisama/Cake-Resque/issues/15.

hongkongkiwi commented 11 years ago

Great, I noticed this feature in other frameworks and thought it would be very useful here.

I'm currently using Resque to send out Apple Push Notifications, so as you can imagine it's really useful to be able to time these for a specific holiday or event :-)

wa0x6e commented 11 years ago

Can you name some of the "other framework" you're referring to ? I guess they're all written in Ruby ?

kallealberg commented 11 years ago

Scheduled jobs would be awsome!

kallealberg commented 11 years ago

Was looking around and found this. https://github.com/chrisboulton/php-resque-scheduler

wa0x6e commented 11 years ago

As I thought, there is no real scheduler like cron in PHP. They're all scheduler that will execute your job after the defined time, not necessarily at the defined time.

It means that job will be executed at the defined time + x seconds (x between 0 and the worker polling interval time)

it should be a piece of cake to add

wa0x6e commented 11 years ago

Added in Version 3.0