Skip to content

Commit

Permalink
Increase the max execution time and memory limit
Browse files Browse the repository at this point in the history
  • Loading branch information
richan-fongdasen committed Sep 21, 2023
1 parent 96d79b8 commit 67498d8
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/Controllers/ScheduledJobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,39 @@ class ScheduledJobController extends BaseController
use DispatchesJobs;
use ValidatesRequests;

/**
* Increase the max execution time when handling a queued job.
*/
protected function increaseExecutionTime(): void
{
ini_set('max_execution_time', 0);
set_time_limit(0);
}

/**
* Increase the memory limit when handling a queued job.
*/
protected function increaseMemoryLimit(): void
{
ini_set('memory_limit', '-1');
}

/**
* Handle scheduled job event invocation.
*
* @return \Illuminate\Http\JsonResponse
*/
public function index(): JsonResponse
{
$this->increaseExecutionTime();
$this->increaseMemoryLimit();

Artisan::call('schedule:run');

return response()->json(['info' => 'The scheduled job has completed.']);
$response = [
'info' => 'The scheduled job has completed.',
];

return response()->json($reponse);

Check failure on line 51 in src/Controllers/ScheduledJobController.php

View workflow job for this annotation

GitHub Actions / analysis (8.2)

Undefined variable: $reponse
}
}

0 comments on commit 67498d8

Please sign in to comment.