Add some comments and a TODO for the supermodel retrying system

This commit is contained in:
Scott Erickson 2016-08-05 13:23:44 -07:00
parent 2287c4f1e5
commit f4c0e4144e
2 changed files with 7 additions and 0 deletions

View file

@ -22,6 +22,9 @@ LOG = false
# * Sprite map generation
# * Connecting to Firebase
# LevelLoader depends on SuperModel retrying timed out requests, as these occasionally happen during play.
# If LevelLoader ever moves away from SuperModel, it will have to manage its own retries.
module.exports = class LevelLoader extends CocoClass
constructor: (options) ->

View file

@ -298,6 +298,10 @@ class ModelResource extends Resource
@loadsAttempted = 0
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.
# This logic is for handling failed responses for level loading.
timeToWait = 5000
tryLoad = =>
return if this.isLoaded