-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fixed slow startup problems #1370
Conversation
1fd0f03
to
9c242a6
Compare
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.
Looks good overall. I have a few thoughts to consider.
Reviewed 12 of 12 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @tjcouch-sil)
src/extension-host/services/contribution.service.ts
line 208 at r1 (raw file):
// Do things in response to finishing resyncing contributions await Promise.all([...onDidResyncContributionsSubscriptions].map(async (callback) => callback()));
Do you think the callbacks should be wrapped in try
/catch
?
src/shared/services/project-lookup.service.test.ts
line 40 at r1 (raw file):
beforeAll(() => { jest.useFakeTimers({
👀
I learn something new every day.
src/shared/models/project-lookup.service-model.ts
line 347 at r1 (raw file):
* process started */ const GRACE_PERIOD_WAIT_TIME_MS = 5 * 1000;
This seems a little slower than we need to be. I would think retrying every second (or a little sooner) would help be more responsive for people than every 5 seconds.
src/shared/models/project-lookup.service-model.ts
line 482 at r1 (raw file):
// Intentionally stopping this method execution to try getting project metadata again // eslint-disable-next-line no-await-in-loop allProjectsMetadataArray = await internalGetMetadata(options);
Making this function recursive and extending an already long function to be even longer makes me a little uneasy. It probably works OK for now, but there could be some weird maintenance impacts (e.g., if someone needs to extend the grace time to a few minutes for really slow machines and shrink the wait time to multiple times per second, potentially resulting in stack overflows on slow machines). I think it would be a little cleaner to put this code into a new function (e.g., internalGetMetadataWithRetries
) and change all the current callers of internalGetMetadata
to point to the new function.
9c242a6
to
84a58a8
Compare
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.
Reviewable status: 10 of 12 files reviewed, all discussions resolved (waiting on @lyonsil)
src/extension-host/services/contribution.service.ts
line 208 at r1 (raw file):
Previously, lyonsil (Matt Lyons) wrote…
Do you think the callbacks should be wrapped in
try
/catch
?
Good idea! Done.
src/shared/models/project-lookup.service-model.ts
line 347 at r1 (raw file):
Previously, lyonsil (Matt Lyons) wrote…
This seems a little slower than we need to be. I would think retrying every second (or a little sooner) would help be more responsive for people than every 5 seconds.
We can try one second. I thought since this gets called a lot and will continually have problems until things start up, might as well wait a while before trying again since chances are it will be a while before things start up well. But this is fine, too, so why not :)
src/shared/models/project-lookup.service-model.ts
line 482 at r1 (raw file):
Previously, lyonsil (Matt Lyons) wrote…
Making this function recursive and extending an already long function to be even longer makes me a little uneasy. It probably works OK for now, but there could be some weird maintenance impacts (e.g., if someone needs to extend the grace time to a few minutes for really slow machines and shrink the wait time to multiple times per second, potentially resulting in stack overflows on slow machines). I think it would be a little cleaner to put this code into a new function (e.g.,
internalGetMetadataWithRetries
) and change all the current callers ofinternalGetMetadata
to point to the new function.
Are you tryna tell me I'm not allowed to achieve a programmer's highest honor and finally cause a StackOverflow.com in the build???????????????
Done :)
src/shared/services/project-lookup.service.test.ts
line 40 at r1 (raw file):
Previously, lyonsil (Matt Lyons) wrote…
👀
I learn something new every day.
Me too haha I had to look this up
84a58a8
to
f0b67b2
Compare
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.
Reviewed 3 of 3 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved
Resolves #1176 (hopefully)
This change is