From 040d9df0b9790cdbf6005c20ce2a4dba7f890204 Mon Sep 17 00:00:00 2001 From: Ryan Meneses Date: Mon, 12 Dec 2022 09:57:34 -0800 Subject: [PATCH 1/3] Retry launchSimulation every 10s on server error. --- src/views/ConfigurationView.vue | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/views/ConfigurationView.vue b/src/views/ConfigurationView.vue index 96ccb6940..38eca9f2d 100644 --- a/src/views/ConfigurationView.vue +++ b/src/views/ConfigurationView.vue @@ -167,7 +167,7 @@ export default { }, methods: { ...mapMutations(['SETGAMEID']), - ...mapActions('modal', ['alert']), + ...mapActions('modal', ['alert', 'timeout']), toggleMenu() { this.menuActive = !this.menuActive @@ -192,9 +192,18 @@ export default { handleAxiosError(error) { console.error(error) - if (error.response && error.response.status === 401) { - this.alert('Please log in again to continue.') - this.$router.push('entry') + if (error.response) { + if (error.response.status === 401) { + this.alert('Please log in again to continue.') + this.$router.push('entry') + } else if (error.response.status === 500) { + this.timeout({ + message: 'Our servers are currently busy right now.\n' + + 'Retrying in 10', + secondsLeft: 10, + timeoutCallback: async () => {await this.launchSimulation()} + }) + } } else { this.alert(error) } From e83f139f5fc530c5f3764b4483e86579617050a6 Mon Sep 17 00:00:00 2001 From: Ryan Meneses Date: Mon, 12 Dec 2022 16:20:02 -0800 Subject: [PATCH 2/3] Cancel launchSimulation retry if user clicks outside of timeout modal. --- src/components/menu/ModalWindow.vue | 11 +++++++++-- src/views/ConfigurationView.vue | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/menu/ModalWindow.vue b/src/components/menu/ModalWindow.vue index a709a86bb..66e53f75d 100644 --- a/src/components/menu/ModalWindow.vue +++ b/src/components/menu/ModalWindow.vue @@ -50,7 +50,8 @@ export default { } }, computed: { - ...mapGetters('modal', ['getModalActive', 'getModalParams', 'getSecondsLeft']), + ...mapGetters('modal', ['getModalActive', 'getModalParams', 'getSecondsLeft', + 'getCountdownEnded']), }, watch: { // Watch params in store/modal, use to show/hide the menu and determine layout @@ -72,7 +73,7 @@ export default { }, methods: { ...mapMutations('modal', ['SETMODALACTIVE', 'RESETMODALPARAMS', - 'STARTCOUNTDOWNTIMER']), + 'STARTCOUNTDOWNTIMER', 'STOPCOUNTDOWNTIMER']), async handleClick(callback) { callback() @@ -85,6 +86,12 @@ export default { } this.SETMODALACTIVE(false) this.RESETMODALPARAMS() + + // The user clicked outside of the timeout modal before the countdown ended + // which cancels the callback function that would have been called at 0. + if (this.getModalParams.type === 'timeout' && !this.getCountdownEnded) { + this.STOPCOUNTDOWNTIMER() + } }, }, } diff --git a/src/views/ConfigurationView.vue b/src/views/ConfigurationView.vue index 38eca9f2d..c3cc5677f 100644 --- a/src/views/ConfigurationView.vue +++ b/src/views/ConfigurationView.vue @@ -201,7 +201,7 @@ export default { message: 'Our servers are currently busy right now.\n' + 'Retrying in 10', secondsLeft: 10, - timeoutCallback: async () => {await this.launchSimulation()} + timeoutCallback: async() => { await this.launchSimulation() }, }) } } else { From ce9513312fcc12977232eb68ca513cc3ca5b4db2 Mon Sep 17 00:00:00 2001 From: Ryan Meneses Date: Tue, 13 Dec 2022 15:49:15 -0800 Subject: [PATCH 3/3] Remove async duplicate. --- src/views/ConfigurationView.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/ConfigurationView.vue b/src/views/ConfigurationView.vue index c3cc5677f..a1001e484 100644 --- a/src/views/ConfigurationView.vue +++ b/src/views/ConfigurationView.vue @@ -201,7 +201,7 @@ export default { message: 'Our servers are currently busy right now.\n' + 'Retrying in 10', secondsLeft: 10, - timeoutCallback: async() => { await this.launchSimulation() }, + timeoutCallback: () => { this.launchSimulation() }, }) } } else {