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

http server default timeout override option #121

Closed
akshaykarode opened this issue May 18, 2019 · 4 comments
Closed

http server default timeout override option #121

akshaykarode opened this issue May 18, 2019 · 4 comments

Comments

@akshaykarode
Copy link

Nodejs http servers default timeout (2 min) should be override by configuration.

@akshaykarode
Copy link
Author

Hello @icebob ,
The past few weeks i was struggling to increase servers requests default timeout, then i found moleculer-web use http module underneath to create server.
So thought to provide configurable option in settings , that user can manipulate as per need of server settings.
My team currently using Moleculer Framework for Server API's. So, need to have this feature as early as possible. I would like to contribute the solution and push into the repository.
Please let me know what can be done to have this on live.
settings :{ httpServerTimeout:180000, // 5 minutes }

LifeCycle change:

      created() {
	     if (this.settings.server !== false) {

		if (_.isObject(this.settings.server)) {
			// Use an existing server instance
			this.server = this.settings.server;
		} else {
			// Create a new HTTP/HTTPS/HTTP2 server instance
			this.createServer();
		}

		// set http server timeout
		if(this.settings.httpServerTimeout){
			this.logger.info("Override Default http/https Server Timeout", this.settings.httpServerTimeout);
			this.server.setTimeout(this.settings.httpServerTimeout)
		}

		/* istanbul ignore next */
		this.server.on("error", err => {
			this.logger.error("Server error", err);
		});

		this.logger.info("API Gateway server created.");
	}

@icebob
Copy link
Member

icebob commented May 18, 2019

Good solution please create a PR.

@akshaykarode
Copy link
Author

I am not able to push the code due to access denied.
remote: Permission to moleculerjs/moleculer-web.git denied to akshaykarode.

@icebob
Copy link
Member

icebob commented May 21, 2019

First of all, you should fork the repo, guide: https://www.youtube.com/watch?v=rgbCcBNZcdQ

akshaykarode pushed a commit to akshaykarode/moleculer-web that referenced this issue May 28, 2019
icebob added a commit that referenced this issue Jul 9, 2019
#121 http-server-default-timeout-override-option added.
@icebob icebob closed this as completed Jul 9, 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

No branches or pull requests

2 participants