maybe another command running at the same time and messing with the active column?
Apr 5, 2023
5
Level 1
Eloquent returns no rows, sometimes, when using scheduler
Hi
I have defined mulitple tasks, like:
$schedule->command('my:command')->cron("*/5 * * * *")->appendOutputTo(storage_path('logs/mycommand.log'))->runInBackground()->withoutOverlapping(10);
And this works fine, most of the time, but sometimes a simple eloquent search returns 0 rows, eventhough, there are rows, and there always is.
$servers = servers::where(['active'=>1])->get();
I cant seem to fine any explanation for this behaviour, and my only theory is that these jobs run at the same time, and creates some kind of conflict, but there are no updates to this table, only selects, but if i add a random sleep() to my code in the commands, it seems to work better.
Ideas?
Thanks in advance :)
info: Running Laravel 9.11, in Docker
Please or to participate in this conversation.