Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Process never exits after statsd use #71

@bryanburgers

Description

@bryanburgers

The code

'use strict'

setInterval(() => {
    console.log('Still alive')
}, 1000).unref()

setTimeout(() => {
    console.log('Done')
}, 500)

prints "Done" then exits.

$ node index.js
Done
$

However, once I introduce a statsd client, the process never exists.

'use strict'

const StatsD = require('node-statsd')
const statsd = new StatsD()

setInterval(() => {
    console.log('Still alive')
}, 1000).unref()

setTimeout(() => {
    statsd.increment('my_counter')
    console.log('Done')
}, 500)

The output is

$ node index.js
Done
Still alive
Still alive
Still alive
Still alive
Still alive
Still alive
Still alive
Still alive
Still alive
...

Is there a way to tell statsd that it should cleanup and not keep the node process alive?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions