
It seems that running Ember.run.later periodically can cause CPU usage to increase over time. Such increase adds up to already increasing CPU usage because of data amount growing. This commit tries to mitigate the issue by using setTimeout instead
15 lines
391 B
CoffeeScript
15 lines
391 B
CoffeeScript
@Travis.Ticker = Ember.Object.extend
|
|
init: ->
|
|
@schedule() unless @get('interval') == -1
|
|
|
|
tick: ->
|
|
context = @get('context')
|
|
targets = @get('targets') || [@get('target')]
|
|
for target in targets
|
|
target = context.get(target) if context
|
|
target.tick() if target
|
|
@schedule()
|
|
|
|
schedule: ->
|
|
setTimeout((=> @tick()), @get('interval') || Travis.TICK_INTERVAL)
|