Repository navigation
fix(console): show a finished teardown without waiting for the tab - #215
Conversation
The operation poll skipped its interval while the tab was hidden, and the app turns window-focus refetching off, so returning to the tab did not refresh it either. A teardown that finished in under a minute showed as in progress for minutes. The operation status now polls in the background and refetches on focus until it settles. After the job finishes, the inventory can still list the entry as active. The review then said the teardown completed and offered Teardown again, and nothing re-read the catalog until the next focus. Each entry whose teardown finished now waits on its own inventory record: the catalog is polled every 3 s, also in the background, until that entry stops reading active, and the review says the job finished and is waiting for the inventory to confirm. Closes dmfdeploy/dmfdeploy#862 Signed-off-by: znerol2 <6800371+znerol2@users.noreply.github.com>
lkirc
left a comment
There was a problem hiding this comment.
Request changes: the valid launched-to-job-ID teardown path still has the hidden-tab and inventory-lag failure this PR is intended to fix.
- frontend/src/pages/MediaWorkloads/stages/FinaliseStage.tsx:304: when the operation poll observes
launched, this path switches touseCatalogJobStatus;handleJobCompleteonly invalidates the catalog. That poller (frontend/src/api/hooks.ts:410) neither runs in the background nor refetches on focus, and a successful job never adds its key toawaitingKeys. A hidden tab can therefore remain stale, and an active-but-lagging catalog entry can again offer Teardown. Apply the same polling and inventory-confirmation flow to this path and coverlaunched-> job-ID in the tests.
When the teardown operation hands off to its automation job, the page polls the job instead. That poll stopped in a hidden tab, and a successful job never waited for the inventory, so the stage could offer Teardown again while the entry still read active. The job status now polls in the background and refetches on focus until it's done. A successful teardown job adds its entry to the pending entries, as run_complete does, and a failed job releases only its own entry. The cleanup effect also reruns when the pending entries change, so an entry added after the inventory already caught up doesn't linger and hold back a later redeploy. Refs dmfdeploy/dmfdeploy#862 Signed-off-by: znerol2 <6800371+znerol2@users.noreply.github.com>
|
Addressed the review in the latest commit: |
What & why
A finished teardown took minutes to show on the workload page. The console's access log from the sandbox run settles the cause (issue comment): the page polled the operation every 3 seconds until 11:39:23Z, then sent nothing until 11:43:31Z. The job finished at 11:39:32Z.
refetchIntervaltick while the document is hidden, and the app setsrefetchOnWindowFocus: false, so returning to the tab didn't refresh the operation.useOperationStatusnow polls in the background and refetches on focus until the operation settles.run_complete, the catalog was read once and then only on focus. If the inventory still listed the entry asactive, the review said "Teardown of X completed." next to a Teardown button. Each entry whose teardown finished is now tracked on its own: the catalog polls every 3 seconds, in the background too, until that entry stops readingactive. Meanwhile the review says "The teardown job for X finished. Waiting for the inventory to confirm." and doesn't offer Teardown for it. A second teardown of another entry, whether it succeeds or fails, doesn't release the first.operationTerminalStallT1's catalog mock kept the entryactiveforever while asserting "completed". It now moves the entry tobootstrappedafter the teardown, which matches the new rule.Closes dmfdeploy/dmfdeploy#862
How it's tested
npm test:Test Files 91 passed (91),Tests 1159 passed (1159).npx tsc --noEmitandnpm run lint: clean.finaliseInventoryConfirm.test.tsxhas nine tests. These cover the waiting line, confirmation without a focus event, return to a hidden tab, background polling, no refetch of a settled operation, mount, pending, unmount and remount, and two entries where the second teardown succeeds or fails. They also cover a hidden-tab inventory flip. Five of the first six fail onorigin/main's source; the sixth guards against over-eager focus refetching. Mutations of the fix each fail their test.Follow-ups, not in this PR: "Already deployed." in the Provision stage and the catalog page have the same inventory lag; the job-id path in Finalise has no waiting line;
useCatalogJobStatusanduseWorkflowJobStatusstill stall in a hidden tab.