mirror of https://github.com/MISP/MISP
chg: [CLI] Initialize BackgroundJobsTool just when required
parent
b322bd55c5
commit
cc1908a7fd
|
@ -79,8 +79,7 @@ class ServerShell extends AppShell
|
|||
));
|
||||
|
||||
foreach ($servers as $serverId => $serverName) {
|
||||
|
||||
$backgroundJobId = $this->Server->getBackgroundJobsTool()->enqueue(
|
||||
$backgroundJobId = $this->getBackgroundJobsTool()->enqueue(
|
||||
BackgroundJobsTool::DEFAULT_QUEUE,
|
||||
BackgroundJobsTool::CMD_SERVER,
|
||||
[
|
||||
|
@ -189,8 +188,7 @@ class ServerShell extends AppShell
|
|||
));
|
||||
|
||||
foreach ($servers as $serverId => $serverName) {
|
||||
|
||||
$jobId = $this->Server->getBackgroundJobsTool()->enqueue(
|
||||
$jobId = $this->getBackgroundJobsTool()->enqueue(
|
||||
BackgroundJobsTool::DEFAULT_QUEUE,
|
||||
BackgroundJobsTool::CMD_SERVER,
|
||||
[
|
||||
|
@ -309,8 +307,7 @@ class ServerShell extends AppShell
|
|||
));
|
||||
|
||||
foreach ($servers as $serverId => $serverName) {
|
||||
|
||||
$jobId = $this->Server->getBackgroundJobsTool()->enqueue(
|
||||
$jobId = $this->getBackgroundJobsTool()->enqueue(
|
||||
BackgroundJobsTool::DEFAULT_QUEUE,
|
||||
BackgroundJobsTool::CMD_SERVER,
|
||||
[
|
||||
|
@ -320,7 +317,7 @@ class ServerShell extends AppShell
|
|||
]
|
||||
);
|
||||
|
||||
$this->out("Enqueued cacheServer from {$serverName} server as job $jobId");
|
||||
$this->out("Enqueued cacheServer from $serverName server as job $jobId");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -605,4 +602,15 @@ class ServerShell extends AppShell
|
|||
}
|
||||
return $server;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BackgroundJobsTool
|
||||
*/
|
||||
private function getBackgroundJobsTool()
|
||||
{
|
||||
if (!$this->BackgroundJobsTool) {
|
||||
$this->BackgroundJobsTool = new BackgroundJobsTool(Configure::read('SimpleBackgroundJobs'));
|
||||
}
|
||||
return $this->BackgroundJobsTool;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue