Reducing some writes to try to help us scale up.

This commit is contained in:
Nick Winter 2014-12-08 06:55:53 -08:00
parent 79a846e482
commit cb54e08b9b
2 changed files with 7 additions and 2 deletions
app
lib
views/play/level/tome

View file

@ -29,7 +29,8 @@ module.exports = class LevelBus extends Bus
constructor: ->
super(arguments...)
@changedSessionProperties = {}
@saveSession = _.debounce(@reallySaveSession, 1000, {maxWait: 5000})
#@saveSession = _.debounce(@reallySaveSession, 1000, {maxWait: 5000}) # not during HoC apparently
@saveSession = _.debounce(@reallySaveSession, 10000, {maxWait: 30000})
@playerIsIdle = false
init: ->

View file

@ -308,7 +308,7 @@ module.exports = class SpellView extends CocoView
# Create locked default code text ranges
@readOnlyRanges = []
if @spell.language in ['python', 'coffeescript']
if @spell.language in ['python', 'coffeescript']
# Lock contiguous section of default code
# Only works for languages without closing delimeters on blocks currently
lines = @aceDoc.getAllLines()
@ -730,6 +730,10 @@ module.exports = class SpellView extends CocoView
hashValue = aether.raw + aetherProblem.message
return if hashValue of @savedProblems
@savedProblems[hashValue] = true
if Math.random() > 0.01
# Let's only save a tiny fraction of these during HoC to reduce writes.
return
# Save new problem
@userCodeProblem = new UserCodeProblem()
@userCodeProblem.set 'code', aether.raw