chore: add logs for subscription maintenance

This commit is contained in:
Danish Arora 2024-09-18 11:34:20 +05:30
parent 8caa220e8f
commit 4554eeab91
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E
2 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,4 @@
export const DEFAULT_KEEP_ALIVE = 30 * 1000;
export const DEFAULT_KEEP_ALIVE = 10_000;
export const DEFAULT_SUBSCRIBE_OPTIONS = {
keepAlive: DEFAULT_KEEP_ALIVE

View File

@ -253,11 +253,13 @@ export class SubscriptionManager implements ISubscription {
}
private startSubscriptionsMaintenance(interval: number): void {
log.info("Starting subscriptions maintenance");
this.startKeepAlivePings(interval);
this.startConnectionListener();
}
private stopSubscriptionsMaintenance(): void {
log.info("Stopping subscriptions maintenance");
this.stopKeepAlivePings();
this.stopConnectionListener();
}
@ -301,6 +303,7 @@ export class SubscriptionManager implements ISubscription {
}
this.keepAliveTimer = setInterval(() => {
log.info("Sending keep-alive ping");
void this.ping()
.then(() => log.info("Keep-alive ping successful"))
.catch((error) => log.error("Error in keep-alive ping cycle:", error));