Skip to content

Commit 889042f

Browse files
committed
fix: add error handling for lock acquisition and set 10s TTL
Lock failures on assignDedicatedServer now log and fall through to alternative assignment strategies instead of propagating unhandled. Lock TTL reduced from default 60s to 10s to match on-demand pattern.
1 parent 721e223 commit 889042f

1 file changed

Lines changed: 26 additions & 11 deletions

File tree

src/matches/match-assistant/match-assistant.service.ts

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,21 @@ export class MatchAssistantService {
232232
});
233233

234234
if (match.options.prefer_dedicated_server) {
235-
const assignedDedicated = await this.assignDedicatedServer(
236-
match.id,
237-
match.region,
238-
);
239-
240-
if (assignedDedicated) {
241-
await this.startMatch(matchId);
242-
return;
235+
try {
236+
const assignedDedicated = await this.assignDedicatedServer(
237+
match.id,
238+
match.region,
239+
);
240+
241+
if (assignedDedicated) {
242+
await this.startMatch(matchId);
243+
return;
244+
}
245+
} catch (error) {
246+
this.logger.error(
247+
`[${matchId}] unable to assign dedicated server`,
248+
error,
249+
);
243250
}
244251
}
245252

@@ -272,9 +279,16 @@ export class MatchAssistantService {
272279
return;
273280
}
274281

275-
if (await this.assignDedicatedServer(match.id, match.region)) {
276-
await this.startMatch(matchId);
277-
return;
282+
try {
283+
if (await this.assignDedicatedServer(match.id, match.region)) {
284+
await this.startMatch(matchId);
285+
return;
286+
}
287+
} catch (error) {
288+
this.logger.error(
289+
`[${matchId}] unable to assign dedicated server`,
290+
error,
291+
);
278292
}
279293

280294
this.logger.log(
@@ -392,6 +406,7 @@ export class MatchAssistantService {
392406

393407
return true;
394408
},
409+
10,
395410
);
396411
}
397412

0 commit comments

Comments
 (0)