mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 04:50:44 -05:00
Wrap saving in try-catch so that if an error occurs the server will continue to save other profiles
This commit is contained in:
parent
4595c29c15
commit
7f2f270534
@ -72,12 +72,19 @@ export class SaveServer {
|
|||||||
*/
|
*/
|
||||||
public async save(): Promise<void> {
|
public async save(): Promise<void> {
|
||||||
const timer = new Timer();
|
const timer = new Timer();
|
||||||
|
let savedProfiles = 0;
|
||||||
|
|
||||||
for (const [sessionId] of this.profiles) {
|
for (const [sessionId] of this.profiles) {
|
||||||
|
try {
|
||||||
await this.saveProfile(sessionId);
|
await this.saveProfile(sessionId);
|
||||||
|
savedProfiles++;
|
||||||
|
} catch (error) {
|
||||||
|
this.logger.error(`Could not save profile ${sessionId} | ${error}`);
|
||||||
}
|
}
|
||||||
const profileCount = this.profiles.size;
|
}
|
||||||
|
|
||||||
this.logger.debug(
|
this.logger.debug(
|
||||||
`Saving ${profileCount} profile${profileCount > 1 ? "s" : ""} took ${timer.getTime("ms")}ms`,
|
`Saving ${savedProfiles} profile${savedProfiles > 1 ? "s" : ""} took ${timer.getTime("ms")}ms`,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user