Skip to content

Commit

Permalink
Increase server close timeout
Browse files Browse the repository at this point in the history
Prior to Node.js 19.0.0, calling close while an idle client was connected to a
server would not actually close the server before the client disconnected. This
behavior was modified in Node.js 19.0.0:

nodejs/node#43522

This resulted in our mock server being closed before we expected and as a
result, some of the tests in `cluster.test.js` would fail. This is because the
1 second timeout is lower than the exponential backoff logic in the
`_autoRetry` function inside the `native_realm.js` file.

To get around this issue, the timeout have simply been incresed to 5 seconds
instead of 1. This is not pretty, but it gets the job done.
  • Loading branch information
Thomas Watson committed Aug 9, 2023
1 parent 460fba9 commit 08f9411
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/kbn-es/src/integration_tests/__fixtures__/es_bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ const { ES_KEY_PATH, ES_CERT_PATH } = require('@kbn/dev-utils');
}
);

// setup server auto close after 1 second of silence
// setup server auto close after 5 second of silence
let serverCloseTimer;
const delayServerClose = () => {
clearTimeout(serverCloseTimer);
serverCloseTimer = setTimeout(() => server.close(), 1000);
serverCloseTimer = setTimeout(() => server.close(), 5000);
};
server.on('request', delayServerClose);
server.on('listening', delayServerClose);
Expand Down

0 comments on commit 08f9411

Please sign in to comment.