mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-01 15:50:11 -04:00
Saven even more slowly for anonymous players during high load
This commit is contained in:
parent
ae6eca583a
commit
e7809c6622
2 changed files with 12 additions and 7 deletions
app
|
@ -28,11 +28,13 @@ module.exports = class LevelBus extends Bus
|
|||
constructor: ->
|
||||
super(arguments...)
|
||||
@changedSessionProperties = {}
|
||||
if application.isProduction()
|
||||
#@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.
|
||||
highLoad = true
|
||||
[wait, maxWait] = switch
|
||||
when not application.isProduction() then [1, 5] # Save quickly in development.
|
||||
when not highLoad then [4, 10] # Save slowly when in production.
|
||||
when not me.isAnonymous() then [10, 30] # Save even more slowly during HoC scaling.
|
||||
else [20, 60] # Save super slowly if anonymous during HoC scaling.
|
||||
@saveSession = _.debounce @reallySaveSession, wait * 1000, {maxWait: maxWait * 1000}
|
||||
@playerIsIdle = false
|
||||
|
||||
init: ->
|
||||
|
|
|
@ -638,18 +638,20 @@ module.exports = class SpellView extends CocoView
|
|||
Backbone.Mediator.publish 'tome:cast-spell', spell: @spell, thang: @thang, preload: preload, realTime: realTime
|
||||
|
||||
notifySpellChanged: =>
|
||||
return if @destroyed
|
||||
Backbone.Mediator.publish 'tome:spell-changed', spell: @spell
|
||||
|
||||
notifyEditingEnded: =>
|
||||
return if @aceDoc.undergoingFirepadOperation # from my Firepad ACE adapter
|
||||
return if @destroyed or @aceDoc.undergoingFirepadOperation # from my Firepad ACE adapter
|
||||
Backbone.Mediator.publish 'tome:editing-ended', {}
|
||||
|
||||
notifyEditingBegan: =>
|
||||
return if @aceDoc.undergoingFirepadOperation # from my Firepad ACE adapter
|
||||
return if @destroyed or @aceDoc.undergoingFirepadOperation # from my Firepad ACE adapter
|
||||
Backbone.Mediator.publish 'tome:editing-began', {}
|
||||
|
||||
updateLines: =>
|
||||
# Make sure there are always blank lines for the player to type on, and that the editor resizes to the height of the lines.
|
||||
return if @destroyed
|
||||
lineCount = @aceDoc.getLength()
|
||||
lastLine = @aceDoc.$lines[lineCount - 1]
|
||||
if lastLine isnt ''
|
||||
|
@ -681,6 +683,7 @@ module.exports = class SpellView extends CocoView
|
|||
spellPaletteView.css('height', newHeight) if @spellPaletteHeight isnt newHeight
|
||||
|
||||
hideProblemAlert: ->
|
||||
return if @destroyed
|
||||
Backbone.Mediator.publish 'tome:hide-problem-alert', {}
|
||||
|
||||
onManualCast: (e) ->
|
||||
|
|
Loading…
Add table
Reference in a new issue