mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-18 09:20:27 -05:00
Auto-reload the page until it breaks
This commit is contained in:
parent
82258c5cc9
commit
c5c685317d
2 changed files with 4 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue