[newrelic] adds waitForIdle option to #shutdown (#42643)

* [newrelic] adds waitForIdle option to #shutdown

* add contributor note
This commit is contained in:
Dylan Smith
2020-02-26 19:34:39 +00:00
committed by GitHub
parent d2cb704742
commit fc6d7fec6e
2 changed files with 6 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
// Kyle Scully <https://github.com/zieka>
// Kenneth Aasan <https://github.com/kennethaasan>
// Jon Flaishans <https://github.com/funkswing>
// Dylan Smith <https://github.com/dylansmith>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// https://docs.newrelic.com/docs/agents/nodejs-agent/api-guides/nodejs-agent-api
@@ -337,7 +338,7 @@ export const instrumentMessages: Instrument;
*/
export function shutdown(cb?: (error?: Error) => void): void;
export function shutdown(
options?: { collectPendingData?: boolean; timeout?: number },
options?: { collectPendingData?: boolean; timeout?: number; waitForIdle?: boolean },
cb?: (error?: Error) => void,
): void;

View File

@@ -109,6 +109,10 @@ newrelic.shutdown({ collectPendingData: true, timeout: 3000 });
newrelic.shutdown({ collectPendingData: true, timeout: 3000 }, err => {
const error: Error | undefined = err;
});
newrelic.shutdown({ collectPendingData: true, timeout: 3000, waitForIdle: true });
newrelic.shutdown({ collectPendingData: true, timeout: 3000, waitForIdle: true }, err => {
const error: Error | undefined = err;
});
newrelic.shutdown(err => {
const error: Error | undefined = err;
});