Skip to content

Commit a64bcae

Browse files
authored
Merge pull request #103 from ubio/hotfix-stop-aux-server-on-app-stop
Hotfix stop aux server on app stop
2 parents 09f41f7 + 0e04a2b commit a64bcae

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

.env.test

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
PORT=3000
22
LOG_LEVEL=mute
33
AC_JWKS_URL=http://auth.example.com
4-
ASSERT_CONFIGS_ON_START=false
5-
START_AUX_HTTP_SERVER_ON_START=false
4+
ASSERT_CONFIGS_ON_START=false

docs/metrics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ In this example, `app_method_latencies_seconds{class="MyClass",method="doWork"}`
6969

7070
### Metrics endpoint
7171

72-
By default, the application will run a http server (in a different port) that handles requests to `GET /metrics` endpoint, unless configured otherwise (i.e. `START_AUX_HTTP_SERVER_ON_START=false` is set). So, you don't have to do anything to expose the metrics reports.
72+
By default, the application will run a http server (in a different port) that handles requests to `GET /metrics` endpoint, unless configured otherwise (i.e. `START_AUX_HTTP_ON_START=false` is set). So, you don't have to do anything to expose the metrics reports.
7373

7474
This endpoint reports metrics from all registered ones, which are:
7575

src/main/application.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { GlobalMetrics } from './metrics/global.js';
1414
export class Application extends BaseApp {
1515

1616
@config({ default: false }) ASSERT_CONFIGS_ON_START!: boolean;
17-
@config({ default: true }) START_AUX_HTTP_SERVER_ON_START!: boolean;
17+
@config({ default: true }) START_AUX_HTTP_ON_START!: boolean;
1818

1919
@dep() httpServer!: HttpServer;
2020
@dep() auxHttpServer!: AuxHttpServer;
@@ -47,14 +47,17 @@ export class Application extends BaseApp {
4747
if (this.ASSERT_CONFIGS_ON_START) {
4848
this.assertConfigs();
4949
}
50-
if (this.START_AUX_HTTP_SERVER_ON_START) {
50+
if (this.START_AUX_HTTP_ON_START) {
5151
await this.auxHttpServer.start();
5252
}
5353
await this.beforeStart();
5454
}
5555

5656
override async stop() {
5757
await super.stop();
58+
if (this.START_AUX_HTTP_ON_START) {
59+
await this.auxHttpServer.stop();
60+
}
5861
await this.afterStop();
5962
}
6063

0 commit comments

Comments
 (0)