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

Remove timeout used with NPM command #6322

Merged
merged 8 commits into from
Aug 27, 2019
Merged

Remove timeout used with NPM command #6322

merged 8 commits into from
Aug 27, 2019

Conversation

TatuLund
Copy link
Contributor

@TatuLund TatuLund commented Aug 26, 2019

Addresses #6299

Supercedes #6165


This change is Reviewable

Copy link
Contributor

@ujoni ujoni left a comment

Choose a reason for hiding this comment

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

After a year-long internal debate we have arrived to the conclusion that the timeout should be removed entirely. This is mostly to adhere to the semver nicely.

Adding a public constant and a configurable system property would essentially require +0.1.0 in the strictest sense. We can do a fancier fix for Flow 2.1 that allows for configuration.

Reviewable status: 2 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @TatuLund)


flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendToolsLocator.java, line 127 at r1 (raw file):

        boolean commandExited = false;
        try {
            commandExited = process.waitFor(processTimeout, TimeUnit.SECONDS);

Please remove timeout entirely. Printing a log message, if the process took a long time could be nice. Say the command execution takes 5s+, we could log a message informing the user what took forever. Maybe that would enable user to investigate and potentially resolve problems with their system.

Copy link
Contributor

@ujoni ujoni left a comment

Choose a reason for hiding this comment

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

Reviewable status: 3 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @TatuLund)


flow-server/src/main/java/com/vaadin/flow/server/Constants.java, line 156 at r1 (raw file):

     * Configuration name for timeout used for NPM detection
     */
    public static final String NPM_COMMAND_TIMEOUT = "npmCommandTimeout";

Please remove

Copy link
Contributor Author

@TatuLund TatuLund left a comment

Choose a reason for hiding this comment

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

Reviewable status: 3 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @ujoni and @vaadin-bot)


flow-server/src/main/java/com/vaadin/flow/server/Constants.java, line 153 at r1 (raw file):

Previously, vaadin-bot (Vaadin Bot) wrote…

CRITICAL First sentence of Javadoc is incomplete (period is missing) or not present. rule

Done.


flow-server/src/main/java/com/vaadin/flow/server/Constants.java, line 156 at r1 (raw file):

Previously, ujoni (Joni) wrote…

Please remove

Done.


flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendToolsLocator.java, line 127 at r1 (raw file):

Previously, ujoni (Joni) wrote…

Please remove timeout entirely. Printing a log message, if the process took a long time could be nice. Say the command execution takes 5s+, we could log a message informing the user what took forever. Maybe that would enable user to investigate and potentially resolve problems with their system.

Done.

Copy link
Contributor

@ujoni ujoni left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r2.
Reviewable status: 1 unresolved discussion, 1 of 1 LGTMs obtained (waiting on @vaadin-bot)

OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from External Reviews to Reviewer approved Aug 27, 2019
@ujoni ujoni changed the title Add option to configure timeout used with NPM command Remove timeout used with NPM command Aug 27, 2019
Copy link
Contributor

@ujoni ujoni left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 unresolved discussions, 1 of 1 LGTMs obtained (waiting on @TatuLund and @vaadin-bot)


flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendToolsLocator.java, line 125 at r2 (raw file):

        long timeStamp = System.currentTimeMillis();
        try {
            commandExited = process.waitFor();

Ah, waitFor() returns an exit code instead of a boolean.

OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from Reviewer approved to External Reviews Aug 27, 2019
Copy link
Contributor Author

@TatuLund TatuLund left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 unresolved discussions, 0 of 1 LGTMs obtained, and 1 stale (waiting on @ujoni and @vaadin-bot)


flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendToolsLocator.java, line 125 at r2 (raw file):

Previously, ujoni (Joni) wrote…

Ah, waitFor() returns an exit code instead of a boolean.

Changed logic accordingly

Copy link
Contributor Author

@TatuLund TatuLund left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 unresolved discussions, 0 of 1 LGTMs obtained, and 1 stale (waiting on @ujoni and @vaadin-bot)


flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendToolsLocator.java, line 125 at r2 (raw file):

Previously, TatuLund (Tatu Lund) wrote…

Changed logic accordingly

Done.

Copy link
Contributor

@ujoni ujoni left a comment

Choose a reason for hiding this comment

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

Reviewable status: 5 unresolved discussions, 0 of 1 LGTMs obtained, and 1 stale (waiting on @TatuLund, @ujoni, and @vaadin-bot)


flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendToolsLocator.java, line 122 at r3 (raw file):

        }

        int exitCode = 0;

Please initialize this to -1. All non-negative exit codes should be considered as "valid" in a sense that the process did exit on its own, and does not need to be force-closed.


flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendToolsLocator.java, line 132 at r3 (raw file):

            return Optional.empty();
        } finally {
            if (exitCode != 0) {

With the changed initial value, should be exitCode == -1.


flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendToolsLocator.java, line 146 at r3 (raw file):

        if (exitCode != 0) {
            log().error(
                    "Could not get a response from '{}' command",

This particular log can be moved inside the

finally {
    if (exitCode == -1)

and could be replaced with

if (exitCode > 0) {
    log().error("Command '{}' failed with exit code '{}'", commandString, exitCode);
}

Copy link
Contributor Author

@TatuLund TatuLund left a comment

Choose a reason for hiding this comment

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

Reviewable status: 5 unresolved discussions, 0 of 1 LGTMs obtained, and 1 stale (waiting on @ujoni and @vaadin-bot)


flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendToolsLocator.java, line 122 at r3 (raw file):

Previously, ujoni (Joni) wrote…

Please initialize this to -1. All non-negative exit codes should be considered as "valid" in a sense that the process did exit on its own, and does not need to be force-closed.

Done.


flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendToolsLocator.java, line 132 at r3 (raw file):

Previously, ujoni (Joni) wrote…

With the changed initial value, should be exitCode == -1.

Done.


flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendToolsLocator.java, line 146 at r3 (raw file):

Previously, ujoni (Joni) wrote…

This particular log can be moved inside the

finally {
    if (exitCode == -1)

and could be replaced with

if (exitCode > 0) {
    log().error("Command '{}' failed with exit code '{}'", commandString, exitCode);
}

Done.

Copy link
Contributor

@ujoni ujoni left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r4.
Reviewable status: 4 unresolved discussions, 1 of 1 LGTMs obtained (waiting on @ujoni and @vaadin-bot)

OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from External Reviews to Reviewer approved Aug 27, 2019
Copy link
Contributor

@ujoni ujoni left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 unresolved discussion, 1 of 1 LGTMs obtained (waiting on @vaadin-bot)

ujoni
ujoni previously approved these changes Aug 27, 2019
Copy link
Contributor

@ujoni ujoni left a comment

Choose a reason for hiding this comment

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

Dismissed @vaadin-bot from a discussion.
Reviewable status: :shipit: complete! all discussions resolved, 1 of 1 LGTMs obtained

OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from Reviewer approved to External Reviews Aug 27, 2019
Copy link
Contributor

@caalador caalador left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r6.
Reviewable status: :shipit: complete! all discussions resolved, 1 of 1 LGTMs obtained, and 1 stale

OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from External Reviews to Reviewer approved Aug 27, 2019
@ujoni ujoni merged commit f0c1dfe into master Aug 27, 2019
OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from Reviewer approved to Done - pending release Aug 27, 2019
@ujoni ujoni deleted the fix6299 branch August 27, 2019 11:52
@ujoni ujoni added this to the 2.1.0.alpha1 milestone Aug 27, 2019
joheriks pushed a commit that referenced this pull request Aug 30, 2019
joheriks pushed a commit that referenced this pull request Aug 30, 2019
joheriks pushed a commit that referenced this pull request Aug 30, 2019
@joheriks joheriks modified the milestones: 2.1.0.alpha1, 2.0.9 Aug 30, 2019
@joheriks joheriks moved this from Done - pending release to Released in OLD Vaadin Flow ongoing work (Vaadin 10+) Sep 2, 2019
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.

None yet

4 participants