Skip to content

Commit 7d47452

Browse files
authored
fix: prevent RCON auto-disconnect from killing cvar generation (#124)
Co-authored-by: Flegma <Flegma@users.noreply.github.com>
1 parent 87e6e0f commit 7d47452

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/rcon/rcon.service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ export class RconService {
120120
const version = server.game_server_node?.version;
121121
if (server.is_dedicated && !version) {
122122
if ((await this.cache.has("cvars")) === false) {
123-
void this.genreateCvars(serverId);
123+
this.genreateCvars(serverId).catch(() => {});
124124
}
125125
} else if (version?.current === true && version?.cvars === false) {
126-
void this.genreateCvars(serverId);
126+
this.genreateCvars(serverId).catch(() => {});
127127
}
128128
} catch {
129129
try {
@@ -251,6 +251,9 @@ export class RconService {
251251
throw Error(`unable to connect to server ${serverId}`);
252252
}
253253

254+
clearTimeout(this.connectTimeouts[serverId]);
255+
delete this.connectTimeouts[serverId];
256+
254257
const prefixes = [
255258
"+",
256259
"-",
@@ -303,8 +306,8 @@ export class RconService {
303306
`unable to generate cvars for build: ${buildId}`,
304307
error,
305308
);
306-
throw error;
307309
} finally {
310+
this.setupConnectionTimeout(serverId);
308311
await this.releaseCvarsLock(buildId);
309312
}
310313
this.logger.log(`generated ${totalCvars} cvars for build: ${buildId}`);

0 commit comments

Comments
 (0)