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: Make export jar task unblock fetch task process #722

Merged
merged 3 commits into from
Mar 8, 2023
Merged

Conversation

CsCherrYY
Copy link
Contributor

fix #720

This PR contains two things:

  • catch potential exceptions when sending request to jdtls
  • wait 1s at most when getting the language server status. Once timeout, will directly return original task (when resolving tasks) or undefined (when providing tasks)

@CsCherrYY CsCherrYY added the bug Something isn't working label Mar 7, 2023
@CsCherrYY CsCherrYY requested a review from jdneo March 7, 2023 09:17
}
return this.tasks;
}

private static getLanguageServerStatusTimeout(): Promise<boolean> {
Copy link
Member

Choose a reason for hiding this comment

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

nit: just calling it languageServerStatusTimeout() should be fine. Since we do not get some real data here

@jdneo jdneo added this to the 0.22.0 milestone Mar 7, 2023
}

public async provideTasks(): Promise<Task[] | undefined> {
if (!await languageServerApiManager.ready()) {
const languageServerStatus = await Promise.race([languageServerApiManager.ready(), BuildArtifactTaskProvider.getLanguageServerStatusTimeout()]);
Copy link
Member

Choose a reason for hiding this comment

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

And let's extract this Promise.race statement to a method with document explaining the reason doing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in 0f4564c we:

  1. extract the utility to languageServerApiManager, named isReady(timeout)
  2. rename original isReady field to isServerReady

Copy link
Member

@jdneo jdneo left a comment

Choose a reason for hiding this comment

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

LGTM!

@jdneo jdneo merged commit 973cff3 into main Mar 8, 2023
@jdneo jdneo deleted the cs-unblock-task branch March 8, 2023 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open build tasks action is blocked
2 participants