-
Notifications
You must be signed in to change notification settings - Fork 16
[Backend] Adjust active runtime initialization logic #495
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
Conversation
get().setActiveRuntime(Array.from(runtimeMap.keys())[0]); | ||
const runtimeList = Array.from(runtimeMap.keys()); | ||
const activeInstances = runtimeList.filter((id) => { | ||
return runtimeMap.get(id)?.status !== undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The status must === "connected"
to be alive. It could be undefined, "disconnected", or "connecting".
But I'd suggest keeping the original logic (use the first runtime regardless of its status) for now.
There are many remaining logic to add:
- This assignment only happens at the initial page loading. When there's no runtime, creating a new runtime wouldn't activate it. So we also need to automatically activate the runtime when creating a new runtime (if there's no runtime).
- We also need to create runtime automatically when creating or opening a repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will continue to work on the runtime-related staff. You can focus on the selective view and don't worry too much at the runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SG, I noticed that the active runtime continues reset in the UI refactor PR, and realized the root cause here. I will close this PR then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
active runtime continues reset
The runtime isn't stable, but this isn't the root cause, and fixing this alone couldn't make it stable.
runtimeMap.set(runtimeId, {}); | ||
// runtimeMap.delete(runtimeId) | ||
runtimeMap.delete(runtimeId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good change, I meant to use runtimeMap.delete
but forgot to uncomment it. I've actually included this in my local code.
Summary
killRuntime()
get called, remove theruntimeId
fromruntimeMap