diff --git a/.changesets/do-not-block-node-js-shutdown.md b/.changesets/do-not-block-node-js-shutdown.md new file mode 100644 index 00000000..3ce54250 --- /dev/null +++ b/.changesets/do-not-block-node-js-shutdown.md @@ -0,0 +1,6 @@ +--- +bump: patch +type: change +--- + +Do not block Node.js shutdown. It is no longer necessary to call `Appsignal.stop` for the Node.js engine to allow itself to shut down. It should still be called and awaited in production scenarios and at the end of scripts, as it ensures that scheduled check-ins are delivered. diff --git a/src/probes/index.ts b/src/probes/index.ts index 3fd7bfa5..bd982190 100644 --- a/src/probes/index.ts +++ b/src/probes/index.ts @@ -71,7 +71,7 @@ class BaseProbeRunner extends EventEmitter implements ProbeRunner { public register(name: string, fn: () => void): void { this.#timers.set( name, - setInterval(() => this.emit(name), 60 * 1000) + setInterval(() => this.emit(name), 60 * 1000).unref() ) this.removeAllListeners(name)