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

Fix internal error on quick project close & open #447

Merged
merged 7 commits into from
Feb 1, 2024

Conversation

mkondratek
Copy link
Contributor

@mkondratek mkondratek commented Jan 31, 2024

Test plan

  • quickly open and close a project (then reopen to see any internal error)

@mkondratek mkondratek self-assigned this Jan 31, 2024
Comment on lines 54 to 55
.orTimeout(4, TimeUnit.SECONDS)
.getNow(false) == true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've seen the error coming from this place. I managed to get it twice but it's a race (hard to reproduce). This approach will not throw anything.

Comment on lines 60 to 61
.orTimeout(4, TimeUnit.SECONDS)
.getNow(false) == true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above. I did the same thing in other places where it seemed relevant.

val notify = didStatusChanged(project)
if (notify) {
updateCodyStatusBarIcons()
if (!project.isDisposed) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another issue - the same scenario (a quick open & close project) - this one is (almost) deterministic. Should not be a case anymore.

ApplicationManager.getApplication().invokeLater {
UpgradeToCodyProNotification(title, content, shouldShowUpgradeOption).notify(project)
}
UpgradeToCodyProNotification(title, content, shouldShowUpgradeOption).notify(project)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrel: redundant invokeLater - notify handles the threading already.

@@ -159,8 +159,8 @@ private static String doReplacements(
.thenCompose(
agent ->
agent.getServer().convertGitCloneURLToCodebaseName(new CloneURL(cloneURL)))
.completeOnTimeout(/* value= */ null, /* timeout= */ 4, TimeUnit.SECONDS)
.get();
.orTimeout(4, TimeUnit.SECONDS)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why that change?
I do not understand how .orTimeout(...).getNow(null) is supposed to work, orTimeout throws exception after a given time, but getNow returns immediately. That orTimeout will do nothing there. I think .completeOnTimeout(...).get() was in fact proper solution.
Please elaborate :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm... I did think about it. Probably getnow. Ignores the timeout 🤔 anyway. My point is I want to ensure that the timeout applies and get will not throw

Copy link
Contributor

@pkukielka pkukielka left a comment

Choose a reason for hiding this comment

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

I added one comment but it applies to a few places. Please do not merge before claryfying.

Base automatically changed from mkondratek/update-cody-commit to main February 1, 2024 10:16
@mkondratek
Copy link
Contributor Author

The icon is more visible and has the same colors as everywhere else.

image
image

Copy link
Contributor

@pkukielka pkukielka left a comment

Choose a reason for hiding this comment

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

LGTM

@pkukielka pkukielka merged commit 905f3e7 into main Feb 1, 2024
1 of 2 checks passed
@pkukielka pkukielka deleted the mkondratek/fix/a-few-fixes branch February 1, 2024 13:56
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