DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

2

Do laravel crons can use the same database connection if executed at the same time on laravel 5.8?

Can somebody help me with this?

Ι have setup 2 laravel cronjobs that both run run queries to the database:

$schedule->command(MyCommand::class,['param', '1'])->daily('1:30')
$schedule->command(MyCommand::class,['param', '2'])->daily('1:30');

And the command is the following:

use Illuminate\Console\Command;

class MyCommand extends Command
{
   $signature = "my:command --param {param}"

   public function run()
   {
      $sql = DB::select(^some_heavy_query^);
      // Do other stuff
   }
}

Both…

Top comments (0)

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay