-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
Description
Invoking async methods in synchronous event handlers (see example below) can lead to unhandled rejections which can trigger fatal application restarts.
if (this.config.acknowledge.timeoutSeconds > 0 && enable)
this.checkStandbyStatusTimer = setInterval(async () => {
if (this._stop)
return;
if (this._lastLsn &&
Date.now() - this.lastStandbyStatusUpdatedTime > this.config.acknowledge.timeoutSeconds * 1000)
await this.acknowledge(this._lastLsn);
}, 1000);
Any async handler should catch all exceptions or avoid async and ensure the invoked promise has a catch handler.
patte and kibae