Skip to content

Commit e097b4a

Browse files
gsdevmekardi31
authored andcommitted
fix: prevent job logging communication issues failing the message
1 parent 37d9c3b commit e097b4a

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

Consumer/JobConsumer.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,17 @@ public function execute(AMQPMessage $message)
4141
$output = $job->run($this->container);
4242

4343
if (isset($data['uuid'])) {
44-
$this->getJobLogRepository()->saveOutput(
45-
$data['uuid'],
46-
strval($output)
47-
);
44+
try {
45+
$this->getJobLogRepository()->saveOutput(
46+
$data['uuid'],
47+
strval($output)
48+
);
49+
} catch (\Throwable $t) {
50+
// do nothing
51+
}
4852
}
4953

50-
} catch (\Exception $e) {
54+
} catch (\Throwable $e) {
5155
$command = '';
5256

5357
if ((isset($job))) {
@@ -64,11 +68,15 @@ public function execute(AMQPMessage $message)
6468
}
6569
// save failure if job had uuid
6670
if (isset($data['uuid'])) {
67-
$this->getJobLogRepository()->saveFailure(
68-
$data['uuid'],
69-
strval($output),
70-
$exitCode ?? 1
71-
);
71+
try {
72+
$this->getJobLogRepository()->saveFailure(
73+
$data['uuid'],
74+
strval($output),
75+
$exitCode ?? 1
76+
);
77+
} catch (\Throwable $t) {
78+
// do nothing
79+
}
7280
}
7381

7482
$this->container->get('logger')->error(sprintf('Job Failed: %s', $command), [

0 commit comments

Comments
 (0)