mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-12 21:30:43 -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> {
|
||||
const timer = new Timer();
|
||||
let savedProfiles = 0;
|
||||
|
||||
for (const [sessionId] of this.profiles) {
|
||||
await this.saveProfile(sessionId);
|
||||
try {
|
||||
await this.saveProfile(sessionId);
|
||||
savedProfiles++;
|
||||
} catch (error) {
|
||||
this.logger.error(`Could not save profile ${sessionId} | ${error}`);
|
||||
}
|
||||
}
|
||||
const profileCount = this.profiles.size;
|
||||
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user