Fix - reports crashed if the user could not be switched (because mailtrain was not run under root). Now an error is reported.
This commit is contained in:
parent
2ac89f3365
commit
7a08ffa596
4 changed files with 52 additions and 13 deletions
|
@ -38,13 +38,31 @@ function startWorker(report) {
|
|||
});
|
||||
}
|
||||
|
||||
function onFailed(msg) {
|
||||
runningWorkersCount--;
|
||||
log.error('ReportProcessor', 'Executing worker process for "%s" (tid %s) failed with message "%s". Current worker count is %s.', report.name, workers[report.id], msg, runningWorkersCount);
|
||||
delete workers[report.id];
|
||||
|
||||
const fields = {
|
||||
state: reports.ReportState.FAILED
|
||||
};
|
||||
|
||||
reports.updateFields(report.id, fields, err => {
|
||||
if (err) {
|
||||
log.error('ReportProcessor', err);
|
||||
}
|
||||
|
||||
setImmediate(startWorkers);
|
||||
});
|
||||
}
|
||||
|
||||
const reportData = {
|
||||
id: report.id,
|
||||
name: report.name
|
||||
};
|
||||
|
||||
runningWorkersCount++;
|
||||
executor.start('report-processor-worker', reportData, onStarted, onFinished);
|
||||
executor.start('report-processor-worker', reportData, onStarted, onFinished, onFailed);
|
||||
}
|
||||
|
||||
function startWorkers() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue