Skip to content

[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

Closed
wants to merge 3 commits into from

Conversation

senwang86
Copy link
Collaborator

Summary

  • Find the alive runtime and set as default active runtime
  • If killRuntime() get called, remove the runtimeId from runtimeMap

@senwang86 senwang86 requested a review from lihebi August 30, 2023 23:10
get().setActiveRuntime(Array.from(runtimeMap.keys())[0]);
const runtimeList = Array.from(runtimeMap.keys());
const activeInstances = runtimeList.filter((id) => {
return runtimeMap.get(id)?.status !== undefined;
Copy link
Collaborator

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:

  1. 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).
  2. We also need to create runtime automatically when creating or opening a repo.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

@lihebi lihebi Aug 30, 2023

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.

@senwang86 senwang86 closed this Aug 30, 2023
runtimeMap.set(runtimeId, {});
// runtimeMap.delete(runtimeId)
runtimeMap.delete(runtimeId);
Copy link
Collaborator

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.

This was referenced Aug 31, 2023
@senwang86 senwang86 deleted the pr_493_patch branch September 7, 2023 22:00
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.

2 participants