Skip to content

Commit fec287f

Browse files
committed
feat: have the Queue-Worker app start up a simple web server for metrics
This is somewhat experimental and temporary (hence the port hack).
1 parent a065427 commit fec287f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/boot/QueueWorkerApp.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import { container } from 'tsyringe';
22
import CliArgumentProvider from '../cli/CliArgumentProvider.js';
3+
import AppConfiguration from '../config/AppConfiguration.js';
34
import ContinuousQueueWorker from '../import_queue/worker/ContinuousQueueWorker.js';
45
import TaskScheduler from '../task_queue/TaskScheduler.js';
6+
import FastifyWebServer from '../webserver/FastifyWebServer.js';
57
import App from './App.js';
68

79
export default class QueueWorkerApp implements App {
810
private taskScheduler: TaskScheduler | undefined;
11+
private webServer: FastifyWebServer | undefined;
912

1013
async boot(): Promise<void> {
1114
if (CliArgumentProvider.determineLeftoverArgs().length !== 0) {
@@ -20,11 +23,21 @@ export default class QueueWorkerApp implements App {
2023
.resolve(ContinuousQueueWorker)
2124
.start();
2225

26+
// DEBUG
27+
const appConfig = container.resolve(AppConfiguration);
28+
this.webServer = container.resolve(FastifyWebServer);
29+
30+
await this.webServer.listen(appConfig.config.serverInterface, appConfig.config.serverPort + 100);
31+
// DEBUG END
32+
2333
console.log('\nQueue worker finished initialization');
2434
}
2535

2636
async shutdown(): Promise<void> {
2737
this.taskScheduler?.dispose();
2838
this.taskScheduler = undefined;
39+
40+
await this.webServer?.shutdown();
41+
this.webServer = undefined;
2942
}
3043
}

src/minecraft/server/ping/AbstractMinecraftServerPing.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export type PotentialServerStatus = {
3535
favicon?: string;
3636
}
3737

38+
// TODO: Handle proxy connection errors and introduce retry mechanism
3839
export default abstract class AbstractMinecraftServerPing {
3940
private static readonly socksProxyConnector = new SocksProxyServerConnector();
4041
private static socksProxyPool: RoundRobinProxyPool<SocksProxyServer> | undefined;

0 commit comments

Comments
 (0)