Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Add Option for HTTP Server keepAliveTimeout (#199)
Browse files Browse the repository at this point in the history
This PR adds an option `keepAliveTimeout`. This option, defaulted to `5000`, specifies the number of milliseconds the server should wait before moving on. The primary use case is to help me debug other tools that use ganache; I get timeouts while I step through code. See https://nodejs.org/api/http.html#http_server_keepalivetimeout for more details
  • Loading branch information
mikeseese authored and davidmurdoch committed Oct 19, 2018
1 parent f2a6400 commit 48028c7
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 51 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Both `.provider()` and `.server()` take a single object which allows you to spec
* `"allowUnlimitedContractSize"`: Allows unlimited contract sizes while debugging. By setting this to `true`, the check within the EVM for contract size limit of 24KB (see [EIP-170](https://git.io/vxZkK)) is bypassed. Setting this to `true` **will** cause `ganache-core` to behave differently than production environments. (default: `false`; **ONLY** set to `true` during debugging).
* `"gasPrice"`: Sets the default gas price for transactions if not otherwise specified. Must be specified as a hex string in wei. Defaults to `"0x77359400"`, or 2 gwei.
* `"gasLimit"`: Sets the block gas limit. Must be specified as a hex string. Defaults to `"0x6691b7"`.
* `"keepAliveTimeout"`: If using `.server()` - Sets the HTTP server's `keepAliveTimeout` in milliseconds. See the [NodeJS HTTP docs](https://bit.ly/2Cr0ZEh) for details. `5000` by default.

# IMPLEMENTED METHODS

Expand Down
4 changes: 3 additions & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
var provider = new Provider(options);

var server = httpServer(provider, logger);
server.keepAliveTimeout = options.keepAliveTimeout;

let connectionCounter = 0;
const connections = {};
Expand Down Expand Up @@ -77,7 +78,8 @@ const defaultOptions = {
logger: {
log: function() {}
},
ws: true
ws: true,
keepAliveTimeout: 5000
}

var _applyDefaultOptions = function(options) {
Expand Down

0 comments on commit 48028c7

Please sign in to comment.