File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 55use Illuminate \Bus \Queueable ;
66use Illuminate \Contracts \Queue \ShouldQueue ;
77use Illuminate \Queue \InteractsWithQueue ;
8+ use Illuminate \Queue \Jobs \SyncJob ;
89use Illuminate \Queue \SerializesModels ;
910use LaravelQueueManager \Repository \QueueConfigRepository ;
1011
@@ -28,9 +29,22 @@ private function preventKillProcess()
2829 });
2930 }
3031
32+ private function reconnectDb ()
33+ {
34+ if ($ this ->job instanceof SyncJob) {
35+ return ;
36+ }
37+
38+ $ connections = \Db::getConnections ();
39+ foreach ($ connections as $ connectionName => $ connection ) {
40+ \Db::reconnect ($ connectionName );
41+ }
42+ }
43+
3144 final public function handle ()
3245 {
3346 $ this ->preventKillProcess ();
47+ $ this ->reconnectDb ();
3448 $ this ->execute ();
3549 }
3650
You can’t perform that action at this time.
0 commit comments