Skip to content

Commit

Permalink
fix: save timeout failsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Mar 28, 2020
1 parent 21f19d3 commit d3b4c64
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client/components/editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ export default {
async save({ rethrow = false, overwrite = false } = {}) {
this.showProgressDialog('saving')
this.isSaving = true
const saveTimeoutHandle = setTimeout(() => {
throw new Error('Save operation timed out.')
}, 30000)
try {
if (this.$store.get('editor/mode') === 'create') {
// --------------------------------------------
Expand Down Expand Up @@ -338,9 +343,13 @@ export default {
icon: 'warning'
})
if (rethrow === true) {
clearTimeout(saveTimeoutHandle)
this.isSaving = false
this.hideProgressDialog()
throw err
}
}
clearTimeout(saveTimeoutHandle)
this.isSaving = false
this.hideProgressDialog()
},
Expand Down

0 comments on commit d3b4c64

Please sign in to comment.