From d0e8184d09b6002b5b0403abe7559f261ee43d27 Mon Sep 17 00:00:00 2001 From: OMPRAKASH MISHRA Date: Wed, 25 Dec 2024 13:22:31 -0800 Subject: [PATCH] fix: add wait on first connect to true for pod health check not to report connection error restarts --- webeoc/src/publishers/actions-taken-publisher.service.ts | 1 + webeoc/src/subscribers/actions-taken-subscriber.service.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/webeoc/src/publishers/actions-taken-publisher.service.ts b/webeoc/src/publishers/actions-taken-publisher.service.ts index 863bf9b82..cfdb751da 100644 --- a/webeoc/src/publishers/actions-taken-publisher.service.ts +++ b/webeoc/src/publishers/actions-taken-publisher.service.ts @@ -17,6 +17,7 @@ export class ActionsTakenPublisherService { private async initializeNATS() { const nc = await connect({ servers: [process.env.NATS_HOST], + waitOnFirstConnect: true, }); this.jsClient = nc.jetstream(); } diff --git a/webeoc/src/subscribers/actions-taken-subscriber.service.ts b/webeoc/src/subscribers/actions-taken-subscriber.service.ts index 6d990b872..d80215384 100644 --- a/webeoc/src/subscribers/actions-taken-subscriber.service.ts +++ b/webeoc/src/subscribers/actions-taken-subscriber.service.ts @@ -19,7 +19,7 @@ export class ActionsTakenSubscriberService implements OnModuleInit { async onModuleInit() { try { - this.natsConnection = await connect({ servers: process.env.NATS_HOST }); + this.natsConnection = await connect({ servers: process.env.NATS_HOST, waitOnFirstConnect: true }); this.jsm = await this.natsConnection.jetstreamManager(); await this.setupStream(); await this.subscribeToTopics();