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