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

resolves #84 configure backoff strategy using primitive data #88

Merged

Conversation

ggrossetie
Copy link
Contributor

resolves #84

@@ -23,7 +23,37 @@ test('tcp backoff', function testTcpBackoff (done) {
const nextBackoffDelay = exponentialStrategy.next()
// initial, 10, 100... next delay should be 1000
expect(nextBackoffDelay).to.eq(1000)
tcpConnection.end(() => done())
tcpConnection.end(() => {
process.stdin.removeAllListeners()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to explicitly remove all listeners on process.stdin otherwise we get:

(node:32722) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 end listeners added to [ReadStream]. Use emitter.setMaxListeners() to increase limit
    at _addListener (node:events:595:17)
    at ReadStream.addListener (node:events:617:10)
    at ReadStream.Readable.on (node:internal/streams/readable:876:35)
    at ReadStream.once (node:events:661:8)
    at ReadStream.Readable.pipe (node:internal/streams/readable:678:9)
    at buildCliSourceStream (/path/to/pino-socket/lib/TcpConnection.js:252:17)
    at factory (/path/to/pino-socket/lib/TcpConnection.js:57:7)
    at Context.<anonymous> (/path/to/pino-socket/test/tcpSocketError.js:31:25)
    at callFnAsync (/path/to/pino-socket/node_modules/mocha/lib/runnable.js:394:21)
    at Test.Runnable.run (/path/to/pino-socket/node_modules/mocha/lib/runnable.js:338:7)
    at Runner.runTest (/path/to/pino-socket/node_modules/mocha/lib/runner.js:666:10)
    at /path/to/pino-socket/node_modules/mocha/lib/runner.js:789:12
    at next (/path/to/pino-socket/node_modules/mocha/lib/runner.js:581:14)
    at /path/to/pino-socket/node_modules/mocha/lib/runner.js:591:7
    at next (/path/to/pino-socket/node_modules/mocha/lib/runner.js:474:14)
    at Immediate.<anonymous> (/path/to/pino-socket/node_modules/mocha/lib/runner.js:559:5)
    at processImmediate (node:internal/timers:466:21)

Not sure if there's a better way to fix this issue...

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina
Copy link
Member

CI is failing

@ggrossetie
Copy link
Contributor Author

Forgot to require perf_hooks for Node 14 (as performance is global on Node 16+)

@mcollina mcollina merged commit 8020f8b into pinojs:master Aug 17, 2022
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.

Allow to configure the backoff strategy using primitive data types
2 participants