scheduling task

This commit is contained in:
Vijay Sebastian
2017-01-05 15:56:55 +05:30
parent 0d346bc437
commit e9e7743018
4 changed files with 45 additions and 44 deletions

View File

@@ -30,8 +30,9 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule)
{
if (env('DB_INSTALL') == 1) {
$queue = $this->getCurrentQueue();
$schedule->command('queue:listen '.$queue, ['--tries' => 1])->everyMinute();
if ($this->getCurrentQueue() != "sync") {
$schedule->command('queue:listen '.$this->getCurrentQueue().' --sleep 60')->everyMinute();
}
$this->execute($schedule, 'fetching');
$this->execute($schedule, 'notification');
$this->execute($schedule, 'work');
@@ -61,34 +62,34 @@ class Kernel extends ConsoleKernel
$at = $command['at'];
switch ($condition) {
case 'everyMinute':
$schedule->everyMinute()->withoutOverlapping();
$schedule->everyMinute();
break;
case 'everyFiveMinutes':
$schedule->everyFiveMinutes()->withoutOverlapping();
$schedule->everyFiveMinutes();
break;
case 'everyTenMinutes':
$schedule->everyTenMinutes()->withoutOverlapping();
$schedule->everyTenMinutes();
break;
case 'everyThirtyMinutes':
$schedule->everyThirtyMinutes()->withoutOverlapping();
$schedule->everyThirtyMinutes();
break;
case 'hourly':
$schedule->hourly()->withoutOverlapping();
$schedule->hourly();
break;
case 'daily':
$schedule->daily()->withoutOverlapping();
$schedule->daily();
break;
case 'dailyAt':
$this->getConditionWithOption($schedule, $condition, $at);
break;
case 'weekly':
$schedule->weekly()->withoutOverlapping();
$schedule->weekly();
break;
case 'monthly':
$schedule->monthly()->withoutOverlapping();
$schedule->monthly();
break;
case 'yearly':
$schedule->yearly()->withoutOverlapping();
$schedule->yearly();
break;
}
}
@@ -97,7 +98,7 @@ class Kernel extends ConsoleKernel
{
switch ($command) {
case 'dailyAt':
$schedule->dailyAt($at)->withoutOverlapping();
$schedule->dailyAt($at);
break;
}
}