Skip to content

JS-771 Support extra Sonar property for timeout of node bridge #5470

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

Merged
merged 10 commits into from
Jun 23, 2025

Conversation

zglicz
Copy link
Contributor

@zglicz zglicz commented Jun 19, 2025

@zglicz zglicz requested a review from vdiez June 19, 2025 13:45
@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod bot changed the title Support extra Sonar property for timeout of node bridge JS-771 Support extra Sonar property for timeout of node bridge Jun 19, 2025
server.mjs Outdated
Comment on lines 22 to 23
const timeoutSeconds =
timeoutArg !== undefined && !isNaN(Number(timeoutArg)) ? Number(timeoutArg) : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const timeoutSeconds =
timeoutArg !== undefined && !isNaN(Number(timeoutArg)) ? Number(timeoutArg) : undefined;
const timeoutSeconds = Number.parseInt(timeoutArg) || undefined;

Copy link
Contributor

Choose a reason for hiding this comment

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

forget about this, 0 needs to be supported

Copy link
Contributor

@vdiez vdiez left a comment

Choose a reason for hiding this comment

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

just a small simplification

can you test in SonarLint pls before merging? kill IDE and node should stay forever in background

Comment on lines 279 to 282
public static int getNodeTimeoutSeconds(Configuration config) {
return config.getInt(NODE_TIMEOUT_PROPERTY).orElse(DEFAULT_TIMEOUT_SECONDS);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather have all these helper function to get properties to JsTsContext.java

private final BridgeServerImpl bridge;

public StandaloneParser() {
this(Http.getJdkHttpClient());
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to check with security about this change. Why was it needed in the first place.

public static final String SONARJS_EXISTING_NODE_PROCESS_PORT =
"SONARJS_EXISTING_NODE_PROCESS_PORT";
private static final Gson GSON = new Gson();
private static final String BRIDGE_DEPLOY_LOCATION = "bridge-bundle";

private final NodeCommandBuilder nodeCommandBuilder;
private final int timeoutSeconds;
private int timeoutSeconds = DEFAULT_TIMEOUT_SECONDS;
Copy link
Contributor

Choose a reason for hiding this comment

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

revert back and use different variables for request timeouts and node timeout

@vdiez vdiez enabled auto-merge (squash) June 23, 2025 14:15
Copy link

@vdiez vdiez merged commit aa978da into master Jun 23, 2025
20 checks passed
@vdiez vdiez deleted the flag-heartbeat branch June 23, 2025 14:25
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