Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poll instance state when instance is transitioning #2360

Merged
merged 10 commits into from
Aug 16, 2024

Conversation

david-crespo
Copy link
Collaborator

@david-crespo david-crespo commented Aug 8, 2024

Closes #2095

Works ok on instance detail:

2024-08-08-instance-polling-works.mp4

Just a draft but we can make some progress here without making big choices. Currently I'm polling every second when the instance is starting, creating, stopping, or rebooting, and not polling otherwise, but that could trivially be changed to poll in both cases but poll faster in a transitioning state.

When I tried to do this on the instance list view, I noticed a very annoying issue thanks to the mock instance we have sitting ("stuck" in the sense that we have no logic in place to get it to change) in starting — every poll request/response causes the whole table to render, which means that any dropdown menu you have open closes on you. This is totally unusable, and is even worse when you consider that an instance may genuinely be stuck in one of these transitioning states. We need to figure out how to keep that menu open through the render. It shouldn't be too bad. It doesn't happen with the corner action menu on instance detail for the starting instance even though that should also be rendering every time, so that bodes well.

2024-08-08-annoying-menu-closing.mp4

Copy link

vercel bot commented Aug 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Aug 16, 2024 8:31pm

@david-crespo
Copy link
Collaborator Author

Fixed it in 2a5fc12.

2024-08-09-instance-list-poll-good.mp4

TIL the useMutation result is not referentially stable. We can eliminate some unnecessary renders in a few spots.

image

fn: () => apiQueryClient.invalidateQueries('instanceList'),
delay: instances.items.some(instanceTransitioning) ? 1000 : null,
})

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if polling when any instance is transitioning is a good idea. Might make more sense to just always poll but on a slower interval like 10s.

@david-crespo
Copy link
Collaborator Author

I realized it's extremely easy to poll on the serial console page and connect as soon as it's running. It seems to work. I want to test how it behaves when you stop the instance.

2024-08-15-poll-serial-console.mp4

rebootInstance,
startInstance,
stopInstanceAsync,
]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file are no longer strictly needed for this PR because I've taken the polling on the list page back out, but they are still very good to do.

@david-crespo
Copy link
Collaborator Author

2024-08-16-polling-instance-state-final-maybe.mp4

@david-crespo david-crespo marked this pull request as ready for review August 16, 2024 17:23
.spinner-secondary .path {
stroke: var(--content-secondary);
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided against using this, but this fixes the variant="secondary" spinner to make the brighter part gray instead of green.

image

@david-crespo david-crespo merged commit 33b7a50 into main Aug 16, 2024
8 checks passed
@david-crespo david-crespo deleted the poll-instance-state branch August 16, 2024 20:45
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Aug 16, 2024
oxidecomputer/console@17ae890...33b7a50

* [33b7a505](oxidecomputer/console@33b7a505) oxidecomputer/console#2360
* [1a2cb52d](oxidecomputer/console@1a2cb52d) oxidecomputer/console#2369
* [9e831174](oxidecomputer/console@9e831174) oxidecomputer/console#2374
* [e30f2eb8](oxidecomputer/console@e30f2eb8) oxidecomputer/console#2373
* [bb53f1b2](oxidecomputer/console@bb53f1b2) oxidecomputer/console#2371
* [29398e74](oxidecomputer/console@29398e74) oxidecomputer/console#2343
* [68e2dc89](oxidecomputer/console@68e2dc89) oxidecomputer/console#2359
* [11e29ed8](oxidecomputer/console@11e29ed8) bump omicron to latest main
* [b6ed3757](oxidecomputer/console@b6ed3757) oxidecomputer/console#2370
* [af6c1f4a](oxidecomputer/console@af6c1f4a) oxidecomputer/console#2368
* [60ef745c](oxidecomputer/console@60ef745c) disallow unreachable code in ts config, fix one case of it
* [3a6f815a](oxidecomputer/console@3a6f815a) oxidecomputer/console#2364
* [80b3f2f3](oxidecomputer/console@80b3f2f3) oxidecomputer/console#2366
* [dab60d9d](oxidecomputer/console@dab60d9d) oxidecomputer/console#2358
* [8e3314f1](oxidecomputer/console@8e3314f1) oxidecomputer/console#2362
* [9b5cdfa0](oxidecomputer/console@9b5cdfa0) bump TS generator for bugfix (just adds whitespace)
* [07b6c151](oxidecomputer/console@07b6c151) oxidecomputer/console#2349
* [d32fddc2](oxidecomputer/console@d32fddc2) Revert "Focus confirm button instead of cancel in modals (oxidecomputer/console#2340)"
* [84a1501e](oxidecomputer/console@84a1501e) oxidecomputer/console#2341
* [6615cb6b](oxidecomputer/console@6615cb6b) oxidecomputer/console#2340
* [e48b0096](oxidecomputer/console@e48b0096) delete unused vscode tasks
* [22a6c50f](oxidecomputer/console@22a6c50f) tighten TypeValueCell spacing
* [4eacb3d7](oxidecomputer/console@4eacb3d7) oxidecomputer/console#2338
* [f278a747](oxidecomputer/console@f278a747) oxidecomputer/console#2332
* [016ad1b4](oxidecomputer/console@016ad1b4) oxidecomputer/console#2337
* [2d1a22a2](oxidecomputer/console@2d1a22a2) oxidecomputer/console#2336
* [be0f087f](oxidecomputer/console@be0f087f) oxidecomputer/console#2329
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Aug 16, 2024
#6366)

oxidecomputer/console@17ae890...33b7a50

* [33b7a505](oxidecomputer/console@33b7a505)
oxidecomputer/console#2360
* [1a2cb52d](oxidecomputer/console@1a2cb52d)
oxidecomputer/console#2369
* [9e831174](oxidecomputer/console@9e831174)
oxidecomputer/console#2374
* [e30f2eb8](oxidecomputer/console@e30f2eb8)
oxidecomputer/console#2373
* [bb53f1b2](oxidecomputer/console@bb53f1b2)
oxidecomputer/console#2371
* [29398e74](oxidecomputer/console@29398e74)
oxidecomputer/console#2343
* [68e2dc89](oxidecomputer/console@68e2dc89)
oxidecomputer/console#2359
* [11e29ed8](oxidecomputer/console@11e29ed8)
bump omicron to latest main
* [b6ed3757](oxidecomputer/console@b6ed3757)
oxidecomputer/console#2370
* [af6c1f4a](oxidecomputer/console@af6c1f4a)
oxidecomputer/console#2368
* [60ef745c](oxidecomputer/console@60ef745c)
disallow unreachable code in ts config, fix one case of it
* [3a6f815a](oxidecomputer/console@3a6f815a)
oxidecomputer/console#2364
* [80b3f2f3](oxidecomputer/console@80b3f2f3)
oxidecomputer/console#2366
* [dab60d9d](oxidecomputer/console@dab60d9d)
oxidecomputer/console#2358
* [8e3314f1](oxidecomputer/console@8e3314f1)
oxidecomputer/console#2362
* [9b5cdfa0](oxidecomputer/console@9b5cdfa0)
bump TS generator for bugfix (just adds whitespace)
* [07b6c151](oxidecomputer/console@07b6c151)
oxidecomputer/console#2349
* [d32fddc2](oxidecomputer/console@d32fddc2)
Revert "Focus confirm button instead of cancel in modals
(oxidecomputer/console#2340)"
* [84a1501e](oxidecomputer/console@84a1501e)
oxidecomputer/console#2341
* [6615cb6b](oxidecomputer/console@6615cb6b)
oxidecomputer/console#2340
* [e48b0096](oxidecomputer/console@e48b0096)
delete unused vscode tasks
* [22a6c50f](oxidecomputer/console@22a6c50f)
tighten TypeValueCell spacing
* [4eacb3d7](oxidecomputer/console@4eacb3d7)
oxidecomputer/console#2338
* [f278a747](oxidecomputer/console@f278a747)
oxidecomputer/console#2332
* [016ad1b4](oxidecomputer/console@016ad1b4)
oxidecomputer/console#2337
* [2d1a22a2](oxidecomputer/console@2d1a22a2)
oxidecomputer/console#2336
* [be0f087f](oxidecomputer/console@be0f087f)
oxidecomputer/console#2329
This was referenced Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poll instance state
1 participant