mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 16:02:20 +02:00
Retry saveSystem and saveSession on timeout
This commit is contained in:
parent
81f5c70aaa
commit
5d6a896458
@ -275,17 +275,22 @@ export class GameData {
|
|||||||
Utils.apiPost(`savedata/update?datatype=${GameDataType.SYSTEM}`, systemData, undefined, true)
|
Utils.apiPost(`savedata/update?datatype=${GameDataType.SYSTEM}`, systemData, undefined, true)
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(error => {
|
.then(error => {
|
||||||
this.scene.ui.savingIcon.hide();
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
console.error(error);
|
||||||
if (error.startsWith('client version out of date')) {
|
if (error.startsWith('client version out of date')) {
|
||||||
|
this.scene.ui.savingIcon.hide();
|
||||||
this.scene.clearPhaseQueue();
|
this.scene.clearPhaseQueue();
|
||||||
this.scene.unshiftPhase(new OutdatedPhase(this.scene));
|
this.scene.unshiftPhase(new OutdatedPhase(this.scene));
|
||||||
|
return resolve(false);
|
||||||
} else if (error.startsWith('session out of date')) {
|
} else if (error.startsWith('session out of date')) {
|
||||||
|
this.scene.ui.savingIcon.hide();
|
||||||
this.scene.clearPhaseQueue();
|
this.scene.clearPhaseQueue();
|
||||||
this.scene.unshiftPhase(new ReloadSessionPhase(this.scene));
|
this.scene.unshiftPhase(new ReloadSessionPhase(this.scene));
|
||||||
|
return resolve(false);
|
||||||
}
|
}
|
||||||
console.error(error);
|
console.log(`Retrying...`);
|
||||||
return resolve(false);
|
this.scene.ui.savingIcon.retry();
|
||||||
|
return this.saveSystem().then(resolve);
|
||||||
}
|
}
|
||||||
resolve(true);
|
resolve(true);
|
||||||
});
|
});
|
||||||
@ -558,12 +563,14 @@ export class GameData {
|
|||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(error => {
|
.then(error => {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
console.error(error);
|
||||||
if (error.startsWith('session out of date')) {
|
if (error.startsWith('session out of date')) {
|
||||||
this.scene.clearPhaseQueue();
|
this.scene.clearPhaseQueue();
|
||||||
this.scene.unshiftPhase(new ReloadSessionPhase(this.scene));
|
this.scene.unshiftPhase(new ReloadSessionPhase(this.scene));
|
||||||
|
return resolve(false);
|
||||||
}
|
}
|
||||||
console.error(error);
|
console.log(`Retrying...`);
|
||||||
return resolve(false);
|
return this.saveSession(this.scene, skipVerification).then(resolve);
|
||||||
}
|
}
|
||||||
console.debug('Session data saved');
|
console.debug('Session data saved');
|
||||||
resolve(true);
|
resolve(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user