fix(xo-server/runJob): emit job:terminated and forward error

Introduced in fd560c351
This commit is contained in:
Julien Fontanet 2021-02-26 16:47:48 +01:00
parent e229deb238
commit cfe6b0d9ab

View File

@ -269,6 +269,8 @@ export default class Jobs {
key: job.key, key: job.key,
type, type,
}) })
const app = this._app
try { try {
const runningJobs = this._runningJobs const runningJobs = this._runningJobs
@ -290,8 +292,6 @@ export default class Jobs {
delete runningJobs[id] delete runningJobs[id]
}) })
const app = this._app
if (type === 'backup') { if (type === 'backup') {
const hookData = { const hookData = {
callId: Math.random().toString(36).slice(2), callId: Math.random().toString(36).slice(2),
@ -389,6 +389,8 @@ export default class Jobs {
}, },
true true
) )
app.emit('job:terminated', runJobId, { type })
throw error
} }
} }