PHRAS-3525 Admin can change status to canceled for multiple job (#4055)

-  Can change status to canceled for multiple running jobs
-  Add confirm when clear table
- Workers, adding try catch on recordadapter for 
 - Delete Worker
 - Webhook Worker
 - Subdefinition Worker
This commit is contained in:
Aina Sitraka
2022-06-16 18:08:46 +03:00
committed by GitHub
parent 0985c37a15
commit f9d19d6fe5
18 changed files with 476 additions and 127 deletions

View File

@@ -52,13 +52,21 @@ class DeleteRecordWorker implements WorkerInterface
$em->rollback();
}
try {
$databox = $this->findDataboxById($payload['databoxId']);
$record = $databox->get_record($payload['recordId']);
$databox = $this->findDataboxById($payload['databoxId']);
$record = $databox->get_record($payload['recordId']);
$record->delete();
$record->delete();
$this->messagePublisher->pushLog(sprintf("record deleted databoxname=%s databoxid=%d recordid=%d", $databox->get_viewname(), $payload['databoxId'], $payload['recordId']));
} catch (\Exception $e) {
$this->messagePublisher->pushLog(sprintf("%s (%s) : Error %s", __FILE__, __LINE__, $e->getMessage()), 'error');
if ($workerRunningJob != null) {
$workerRunningJob->setInfo('error : ' . $e->getMessage());
$em->persist($workerRunningJob);
}
}
$this->messagePublisher->pushLog(sprintf("record deleted databoxname=%s databoxid=%d recordid=%d", $databox->get_viewname(), $payload['databoxId'], $payload['recordId']));
// tell that the delete is finished
if ($workerRunningJob != null) {
$workerRunningJob

View File

@@ -65,8 +65,14 @@ class SubdefCreationWorker implements WorkerInterface
$databoxId = $payload['databoxId'];
$subdefName = $payload['subdefName'];
$databox = $this->findDataboxById($databoxId);
$record = $databox->get_record($recordId);
try {
$databox = $this->findDataboxById($databoxId);
$record = $databox->get_record($recordId);
} catch (\Exception $e) {
$this->logger->error(sprintf("%s (%s) : record not found %s", __FILE__, __LINE__, $e->getMessage()));
return;
}
if ($record->isStory()) {
return;

View File

@@ -114,7 +114,15 @@ class WebhookWorker implements WorkerInterface
$this->messagePublisher->pushLog(sprintf('Processing event "%s" with id %d', $webhookevent->getName(), $webhookevent->getId()));
// send requests
$this->deliverEvent($httpClient, $thirdPartyApplications, $webhookevent, $payload);
try {
$this->deliverEvent($httpClient, $thirdPartyApplications, $webhookevent, $payload);
} catch (\Exception $e) {
if ($workerRunningJob != null) {
$workerRunningJob->setInfo('error ' . $e->getMessage());
$em->persist($workerRunningJob);
}
}
}
if ($workerRunningJob != null) {

View File

@@ -89,7 +89,13 @@ class WriteMetadatasWorker implements WorkerInterface
// here we can work
$record = $databox->get_record($recordId);
try {
$record = $databox->get_record($recordId);
} catch (\Exception $e) {
$this->repoWorker->markFinished($workerRunningJobId, "error " . $e->getMessage());
return;
}
if ($record->getMimeType() == 'image/svg+xml') {