We have guzzlehttp/guzzle 6.3.0 installed.
I am trying to move a bunch of legacy CRON jobs from an old server over to the Laravel scheduler. The CRON jobs we are moving simply CURL a url that handles various DB caching processes and such.
I set up some schedules like this and they work fine:
$schedule->call(
function(){
$client = new Client(); //GuzzleHttp\Client
$client->request('GET', 'https://mydomain.com/route/to/php/file.php');
Log::info("Ran process x");
}
)
->timezone('America/New_York')
->weekdays()
->at('7:00');
After reviewing the docs further, and because I have about 20+ of these tasks to schedule, I wanted to simplify the call and reduce the code lines. I came up with this:
$schedule->call(function(){Log::info('Ran process x');})
->pingBefore('https://mydomain.com/route/to/php/file.php')
->timezone('America/New_York')
->weekdays()
->at('7:00');
I set up the pingBefore() route to write something to the DB just so I could verify that the pingBefore() actually fires; the pingBefore() does not seem to be working. The log is written but not the DB. I can hit the route manually and the DB is written to so it is not an issue with the route. I am testing this locally by running php artisan schedule:run. For the purpose of testing I scheduled the test task to run every minute.
Does anyone have any experience with the pingBefore()method or see any reason this wouldn't work? I want to hit a route and log that the task was run.