Skip to content

Commit 320835f

Browse files
author
Chomp
committedNov 23, 2024·
Fixed dep injection issue causing server to not start - http server isn't capable of injecting DatabaseService
Made `PostDbLoadProcess` error out if db validation fails
1 parent db88c00 commit 320835f

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed
 

‎project/src/servers/HttpServer.ts

-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { WebSocketServer } from "@spt/servers/WebSocketServer";
1010
import { IHttpListener } from "@spt/servers/http/IHttpListener";
1111
import { LocalisationService } from "@spt/services/LocalisationService";
1212
import { inject, injectAll, injectable } from "tsyringe";
13-
import { DatabaseService } from "@spt/services/DatabaseService";
1413

1514
@injectable()
1615
export class HttpServer {
@@ -19,7 +18,6 @@ export class HttpServer {
1918

2019
constructor(
2120
@inject("PrimaryLogger") protected logger: ILogger,
22-
@inject("DatabaseService") protected databaseService: DatabaseService,
2321
@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper,
2422
@inject("LocalisationService") protected localisationService: LocalisationService,
2523
@injectAll("HttpListener") protected httpListeners: IHttpListener[],
@@ -36,12 +34,6 @@ export class HttpServer {
3634
public load(): void {
3735
this.started = false;
3836

39-
// If the database couldn't be validated, don't start the server
40-
if (!this.databaseService.isDatabaseValid())
41-
{
42-
return;
43-
}
44-
4537
/* create server */
4638
const httpServer: Server = http.createServer();
4739

‎project/src/services/PostDbLoadService.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ export class PostDbLoadService {
6161
// Kill the startup if not.
6262
// TODO: We can probably remove this in a couple versions
6363
this.databaseService.validateDatabase();
64-
if (!this.databaseService.isDatabaseValid())
65-
{
66-
return;
64+
if (!this.databaseService.isDatabaseValid()) {
65+
throw new Error("Server start failure");
6766
}
6867

6968
this.addCustomLooseLootPositions();

0 commit comments

Comments
 (0)
Please sign in to comment.