Auto-reload the page until it breaks

This commit is contained in:
Phoenix Eliot 2016-08-10 12:38:32 -07:00
parent 82258c5cc9
commit c5c685317d
2 changed files with 4 additions and 2 deletions

View file

@ -417,6 +417,7 @@ module.exports = class LevelLoader extends CocoClass
@supermodel.loadModel(model, resourceName)
onSupermodelLoaded: ->
location.reload() unless @supermodel.failed
clearTimeout @loadTimeoutID
return if @destroyed
console.log 'SuperModel for Level loaded in', new Date().getTime() - @t0, 'ms' if LOG

View file

@ -299,13 +299,14 @@ class ModelResource extends Resource
load: ->
# TODO: Track progress on requests and don't retry if progress was made recently.
# Probably use _.debounce and attach event listeners to xhr objects.
# Probably use _.debounce and attach event listeners to xhr objects.
# This logic is for handling failed responses for level loading.
timeToWait = 5000
tryLoad = =>
return if this.isLoaded
if @loadsAttempted > 4
if @loadsAttempted > 0 # TODO: replace with 4
console.log "[remove] Didn't load model in #{timeToWait}ms (attempt ##{@loadsAttempted}), maybe trying again: ", _.result(@model, 'url')
@markFailed()
return @
@markLoading()