fix(xen-api/_watchEvents): dont fetch events while fetching tasks

When our tasks cache is desynchronized we re-fetch all tasks.

We must wait before fetching the next events to have fetch the tasks otherwise we risk a race condition.
This commit is contained in:
Julien Fontanet
2019-02-28 16:30:39 +01:00
parent 7559fbdab7
commit c5a5ef6c93

View File

@@ -1038,7 +1038,7 @@ export class Xapi extends EventEmitter {
// detect and fix disappearing tasks (e.g. when toolstack restarts)
if (result.valid_ref_counts.task !== this._nTasks) {
ignoreErrors.call(
await ignoreErrors.call(
this._sessionCall('task.get_all_records').then(tasks => {
const toRemove = new Set()
forOwn(this.objects.all, object => {