mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-29 23:43:51 -04: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
app
|
@ -417,6 +417,7 @@ module.exports = class LevelLoader extends CocoClass
|
||||||
@supermodel.loadModel(model, resourceName)
|
@supermodel.loadModel(model, resourceName)
|
||||||
|
|
||||||
onSupermodelLoaded: ->
|
onSupermodelLoaded: ->
|
||||||
|
location.reload() unless @supermodel.failed
|
||||||
clearTimeout @loadTimeoutID
|
clearTimeout @loadTimeoutID
|
||||||
return if @destroyed
|
return if @destroyed
|
||||||
console.log 'SuperModel for Level loaded in', new Date().getTime() - @t0, 'ms' if LOG
|
console.log 'SuperModel for Level loaded in', new Date().getTime() - @t0, 'ms' if LOG
|
||||||
|
|
|
@ -299,13 +299,14 @@ class ModelResource extends Resource
|
||||||
|
|
||||||
load: ->
|
load: ->
|
||||||
# TODO: Track progress on requests and don't retry if progress was made recently.
|
# 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.
|
# This logic is for handling failed responses for level loading.
|
||||||
timeToWait = 5000
|
timeToWait = 5000
|
||||||
tryLoad = =>
|
tryLoad = =>
|
||||||
return if this.isLoaded
|
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()
|
@markFailed()
|
||||||
return @
|
return @
|
||||||
@markLoading()
|
@markLoading()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue