Reduce some writes during HoC to help scaling

This commit is contained in:
Nick Winter 2015-11-30 12:53:46 -08:00
parent 60f40bb859
commit 2588bfb08b
2 changed files with 3 additions and 1 deletions
app
lib
views/play/level/tome

View file

@ -29,7 +29,8 @@ module.exports = class LevelBus extends Bus
super(arguments...)
@changedSessionProperties = {}
if application.isProduction()
@saveSession = _.debounce(@reallySaveSession, 4000, {maxWait: 10000}) # Save slower on production.
#@saveSession = _.debounce(@reallySaveSession, 4000, {maxWait: 10000}) # Save slower on production.
@saveSession = _.debounce(@reallySaveSession, 10000, {maxWait: 30000}) # Save even slower during HoC.
else
@saveSession = _.debounce(@reallySaveSession, 1000, {maxWait: 5000}) # Save quickly in development.
@playerIsIdle = false

View file

@ -834,6 +834,7 @@ module.exports = class SpellView extends CocoView
hashValue = aether.raw + aetherProblem.message
return if hashValue of @savedProblems
@savedProblems[hashValue] = true
return unless Math.random() < 0.01 # Let's only save a tiny fraction of these during HoC to reduce writes.
# Save new problem
@userCodeProblem = new UserCodeProblem()