chore(xen-api): TODO do not cancel a finished task

This commit is contained in:
Julien Fontanet 2018-03-06 16:26:05 +01:00
parent 6abf3fc0af
commit 7fd615525a

View File

@ -408,6 +408,7 @@ export class Xapi extends EventEmitter {
? Promise.reject(new Error(`cannot call ${method}() in read only mode`)) ? Promise.reject(new Error(`cannot call ${method}() in read only mode`))
: this._sessionCall(`Async.${method}`, args).then(taskRef => { : this._sessionCall(`Async.${method}`, args).then(taskRef => {
$cancelToken.promise.then(() => { $cancelToken.promise.then(() => {
// TODO: do not trigger if the task is already over
this._sessionCall('task.cancel', [taskRef]).catch(noop) this._sessionCall('task.cancel', [taskRef]).catch(noop)
}) })