-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4906 from novuhq/nv-3202-race-condition-when-read…
…ing-the-service-instance-sw-health-indicator Race condition when reading the service instance - SW Health Indicator
- Loading branch information
Showing
7 changed files
with
71 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { WebSocketWorker } from './web-socket.worker'; | ||
export { WSHealthIndicator } from './ws-health-indicator.service'; |
25 changes: 25 additions & 0 deletions
25
apps/ws/src/socket/services/ws-health-indicator.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { HealthIndicator, HealthIndicatorResult } from '@nestjs/terminus'; | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
import { IHealthIndicator } from '@novu/application-generic'; | ||
|
||
import { WSGateway } from '../ws.gateway'; | ||
|
||
@Injectable() | ||
export class WSHealthIndicator extends HealthIndicator implements IHealthIndicator { | ||
private INDICATOR_KEY = 'ws'; | ||
|
||
constructor(private wsGateway: WSGateway) { | ||
super(); | ||
} | ||
|
||
async isHealthy(): Promise<HealthIndicatorResult> { | ||
const status = !!this.wsGateway.server; | ||
|
||
return this.getStatus(this.INDICATOR_KEY, status); | ||
} | ||
|
||
isActive(): Promise<HealthIndicatorResult> { | ||
return this.isHealthy(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters