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

Start vnu server on the first available port #1

Open
prantlf opened this issue May 28, 2018 · 0 comments · May be fixed by #2
Open

Start vnu server on the first available port #1

prantlf opened this issue May 28, 2018 · 0 comments · May be fixed by #2

Comments

@prantlf
Copy link

prantlf commented May 28, 2018

The vnu server can save considerable amount of time, when HTML pages are validated during a CI/CD build. Even around 50 pages can be validated in 15 seconds instead of in 50 seconds, when the server is used instead of starting multiple java processes.

However, when multiple builds run on a single machine concurrently, some of them fail, because the vnu server can be configured for a single port only and if another server is running, another one cannot be started. This problem has two solutions:

  1. Run the vnu server separately as a shared service for all builds.
  2. Make the vnu server within the single build using just the available port.

The first option looks better, but may break the requirement of freezing the build tool version after release. The second option means less investment in changes of the build process, especially if Grunt is used.

How about introducing the parameter useAvailablePort similar to grunt-contrib-connect to let the concurrent Grunt builds succeed using the option 2 from above?

Example extracted from README.md:

var vnuPort;

grunt.initConfig({
    vnuserver: {
        options: {
            port: 49152,
            useAvailablePort: true
        }
    },
    htmllint: {
        options: {
            server: function () {
                return {
                    port: vnuPort
                };
            }
        },
        all: {
            src: "app.html"
        }
    }
});

grunt.event.on('vnuserver.listening', function (port) {
    vnuPort = port;
});
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 a pull request may close this issue.

1 participant