Merge pull request #1143 from pterodactyl/feature/cron-job-fix
Fix cron jobs by removing the extra unusable argument
This commit is contained in:
commit
ce242d0cb0
6 changed files with 7 additions and 7 deletions
|
@ -63,7 +63,7 @@ class ProcessScheduleService
|
||||||
{
|
{
|
||||||
$this->repository->loadTasks($schedule);
|
$this->repository->loadTasks($schedule);
|
||||||
|
|
||||||
$formattedCron = sprintf('%s %s %s * %s *',
|
$formattedCron = sprintf('%s %s %s * %s',
|
||||||
$schedule->cron_minute,
|
$schedule->cron_minute,
|
||||||
$schedule->cron_hour,
|
$schedule->cron_hour,
|
||||||
$schedule->cron_day_of_month,
|
$schedule->cron_day_of_month,
|
||||||
|
|
|
@ -86,7 +86,7 @@ class ScheduleCreationService
|
||||||
*/
|
*/
|
||||||
private function getCronTimestamp(array $data)
|
private function getCronTimestamp(array $data)
|
||||||
{
|
{
|
||||||
$formattedCron = sprintf('%s %s %s * %s *',
|
$formattedCron = sprintf('%s %s %s * %s',
|
||||||
array_get($data, 'cron_minute', '*'),
|
array_get($data, 'cron_minute', '*'),
|
||||||
array_get($data, 'cron_hour', '*'),
|
array_get($data, 'cron_hour', '*'),
|
||||||
array_get($data, 'cron_day_of_month', '*'),
|
array_get($data, 'cron_day_of_month', '*'),
|
||||||
|
|
|
@ -98,7 +98,7 @@ class ScheduleUpdateService
|
||||||
*/
|
*/
|
||||||
private function getCronTimestamp(array $data)
|
private function getCronTimestamp(array $data)
|
||||||
{
|
{
|
||||||
$formattedCron = sprintf('%s %s %s * %s *',
|
$formattedCron = sprintf('%s %s %s * %s',
|
||||||
array_get($data, 'cron_minute', '*'),
|
array_get($data, 'cron_minute', '*'),
|
||||||
array_get($data, 'cron_hour', '*'),
|
array_get($data, 'cron_hour', '*'),
|
||||||
array_get($data, 'cron_day_of_month', '*'),
|
array_get($data, 'cron_day_of_month', '*'),
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ProcessScheduleServiceTest extends TestCase
|
||||||
|
|
||||||
$this->repository->shouldReceive('loadTasks')->with($model)->once()->andReturn($model);
|
$this->repository->shouldReceive('loadTasks')->with($model)->once()->andReturn($model);
|
||||||
|
|
||||||
$formatted = sprintf('%s %s %s * %s *', $model->cron_minute, $model->cron_hour, $model->cron_day_of_month, $model->cron_day_of_week);
|
$formatted = sprintf('%s %s %s * %s', $model->cron_minute, $model->cron_hour, $model->cron_day_of_month, $model->cron_day_of_week);
|
||||||
$this->repository->shouldReceive('update')->with($model->id, [
|
$this->repository->shouldReceive('update')->with($model->id, [
|
||||||
'is_processing' => true,
|
'is_processing' => true,
|
||||||
'next_run_at' => CronExpression::factory($formatted)->getNextRunDate(),
|
'next_run_at' => CronExpression::factory($formatted)->getNextRunDate(),
|
||||||
|
|
|
@ -64,7 +64,7 @@ class ScheduleCreationServiceTest extends TestCase
|
||||||
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
|
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
|
||||||
$this->repository->shouldReceive('create')->with([
|
$this->repository->shouldReceive('create')->with([
|
||||||
'server_id' => $server->id,
|
'server_id' => $server->id,
|
||||||
'next_run_at' => CronExpression::factory('* * * * * *')->getNextRunDate(),
|
'next_run_at' => CronExpression::factory('* * * * *')->getNextRunDate(),
|
||||||
'test_key' => 'value',
|
'test_key' => 'value',
|
||||||
])->once()->andReturn($schedule);
|
])->once()->andReturn($schedule);
|
||||||
$this->connection->shouldReceive('commit')->withNoArgs()->once()->andReturnNull();
|
$this->connection->shouldReceive('commit')->withNoArgs()->once()->andReturnNull();
|
||||||
|
@ -85,7 +85,7 @@ class ScheduleCreationServiceTest extends TestCase
|
||||||
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
|
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
|
||||||
$this->repository->shouldReceive('create')->with([
|
$this->repository->shouldReceive('create')->with([
|
||||||
'server_id' => $server->id,
|
'server_id' => $server->id,
|
||||||
'next_run_at' => CronExpression::factory('* * * * * *')->getNextRunDate(),
|
'next_run_at' => CronExpression::factory('* * * * *')->getNextRunDate(),
|
||||||
'test_key' => 'value',
|
'test_key' => 'value',
|
||||||
])->once()->andReturn($schedule);
|
])->once()->andReturn($schedule);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ class ScheduleUpdateServiceTest extends TestCase
|
||||||
|
|
||||||
$this->connection->shouldReceive('beginTransaction')->once()->withNoArgs();
|
$this->connection->shouldReceive('beginTransaction')->once()->withNoArgs();
|
||||||
$this->repository->shouldReceive('update')->once()->with($schedule->id, array_merge($data, [
|
$this->repository->shouldReceive('update')->once()->with($schedule->id, array_merge($data, [
|
||||||
'next_run_at' => CronExpression::factory('1 2 3 * 4 *')->getNextRunDate(),
|
'next_run_at' => CronExpression::factory('1 2 3 * 4')->getNextRunDate(),
|
||||||
]))->andReturn($schedule);
|
]))->andReturn($schedule);
|
||||||
|
|
||||||
$this->taskRepository->shouldReceive('deleteWhere')->once()->with([['schedule_id', '=', $schedule->id]]);
|
$this->taskRepository->shouldReceive('deleteWhere')->once()->with([['schedule_id', '=', $schedule->id]]);
|
||||||
|
|
Loading…
Reference in a new issue