From 0607a901873e60a75e38c52566f9b891e32314af Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 4 Jul 2023 16:58:10 +0200 Subject: [PATCH] XXX serialize events --- src/app.jsx | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/app.jsx b/src/app.jsx index 22537a3d6..75cc256cf 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -196,7 +196,7 @@ class Application extends React.Component { } updateContainersAfterEvent(system, init) { - client.getContainers(system) + return client.getContainers(system) .then(reply => Promise.all( (reply || []).map(container => this.isContainerCheckpointPresent(container.Id, system) @@ -292,7 +292,7 @@ class Application extends React.Component { } updateContainerAfterEvent(id, system, event) { - client.getContainers(system, id) + return client.getContainers(system, id) .then(reply => Promise.all( (reply || []).map(container => this.isContainerCheckpointPresent(container.Id, system) @@ -391,14 +391,14 @@ class Application extends React.Component { * now we 'll do a batch update */ case 'start': - // HACK: We don't get 'started' event for pods got started by the first container which was added to them - // https://github.com/containers/podman/issues/7213 - if (event.Actor.Attributes.podId) { - this.updatePodAfterEvent(event.Actor.Attributes.podId, system); - } else { - this.updatePodsAfterEvent(system); - } - this.updateContainerAfterEvent(event.Actor.ID, system, event); + this.updateContainerAfterEvent(event.Actor.ID, system, event).then(() => { + // HACK: We don't get 'started' event for pods got started by the first container which was added to them + // https://github.com/containers/podman/issues/7213 + if (event.Actor.Attributes.podId) + this.updatePodAfterEvent(event.Actor.Attributes.podId, system); + else + this.updatePodsAfterEvent(system); + }); break; case 'checkpoint': case 'create': @@ -419,14 +419,14 @@ class Application extends React.Component { this.updateContainerAfterEvent(event.Actor.ID, system, event); break; case 'remove': - // HACK: we don't get a pod event when a container in a pod is removed. - // https://github.com/containers/podman/issues/15408 - if (event.Actor.Attributes.podId) { - this.updatePodAfterEvent(event.Actor.Attributes.podId, system); - } else { - this.updatePodsAfterEvent(system); - } - this.updateContainersAfterEvent(system); + this.updateContainersAfterEvent(system).then(() => { + // HACK: we don't get a pod event when a container in a pod is removed. + // https://github.com/containers/podman/issues/15408 + if (event.Actor.Attributes.podId) + this.updatePodAfterEvent(event.Actor.Attributes.podId, system); + else + this.updatePodsAfterEvent(system); + }); break; /* The following events need only to update the Image list */ case 'commit':