Cms: Every Minute event

Created on 31 Jan 2017  Â·  8Comments  Â·  Source: craftcms/cms

Created by: Christian ([email protected]) on 2015/03/09 00:49:13 +0000
Votes at time of UserVoice import: 1


It would be great it there was an event that Craft triggers every minute. The dev sets up a cron that calls a controller action to make this possible, and would then be able to do all kind of cool things when listening to that event.

craft()->on('global.everyMinute', function(Event $event) {
$interval = $event->params['interval'];

if (in_array(5, $interval)) { 
    // cool things every 5 minutes :) 
}

});

enhancement extensibility

All 8 comments

Issue can be closed.
@joshangell just released https://github.com/supercool/Scheduler, which does all I wanted and more.

I don't think it should be closed. Ideally, I think it should be even more like Laravel Scheduler.

More flexibility, repeating jobs, etc.
Josh's Scheduler is more for one-off jobs.

I kind of agree, though Scheduler can be used for repeating jobs, you can
just re-create it after its run. I'll probably document some examples at
some point.

On Thu, 23 Mar 2017 at 12:23, Fred Calsen notifications@github.com wrote:

I don't think it should be closed. Ideally, I think it should be even more
like Laravel Scheduler.

More flexibility, repeating jobs, etc.
Josh's Scheduler is more for one-off jobs.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/craftcms/cms/issues/1260#issuecomment-288702181, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAYq-4A9wkOGaqMxoZhNtfOZ_wsivAhZks5romQ3gaJpZM4LyNzD
.

>

-Josh
angell.io - specialist Craft CMS development and consultancy

Going to leave it open, because we definitely have plans of doing something like this in core.

Great job on the plugin, @joshangell!

I like how Laravel Scheduler allow you to both run console commands, closures and Command classes, as well as it's descriptive, chainable way of defining jobs.

Would be a ideal inspiration source for how this could work in the core.

I found https://github.com/omnilight/yii2-scheduling today. Looks like a good base to use for adding this.

We’re using that omnilight/yii2-scheduling package in Craftnet. Works well!

Was this page helpful?
0 / 5 - 0 ratings