Change Ember.run.later to setTimeout in periodic actions
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
This commit is contained in:
parent
3df9ee9723
commit
4288e79044
|
@ -9,7 +9,7 @@ Travis.RepoController = Travis.Controller.extend
|
|||
|
||||
init: ->
|
||||
@_super.apply this, arguments
|
||||
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
||||
setTimeout(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
||||
|
||||
updateTimes: ->
|
||||
if builds = @get('builds')
|
||||
|
@ -21,7 +21,7 @@ Travis.RepoController = Travis.Controller.extend
|
|||
if build && jobs = build.get('jobs')
|
||||
jobs.forEach (j) -> j.updateTimes()
|
||||
|
||||
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
||||
setTimeout(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
||||
|
||||
activate: (action) ->
|
||||
@_unbind()
|
||||
|
|
|
@ -27,7 +27,7 @@ Travis.ReposController = Ember.ArrayController.extend
|
|||
|
||||
init: ->
|
||||
@_super.apply this, arguments
|
||||
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
||||
setTimeout(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
||||
|
||||
recentRepos: (->
|
||||
Travis.Repo.find()
|
||||
|
@ -44,7 +44,7 @@ Travis.ReposController = Ember.ArrayController.extend
|
|||
if content = @get('content')
|
||||
content.forEach (r) -> r.updateTimes()
|
||||
|
||||
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
||||
setTimeout(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
||||
|
||||
activate: (tab, params) ->
|
||||
@set('sortProperties', null)
|
||||
|
|
|
@ -11,4 +11,4 @@
|
|||
@schedule()
|
||||
|
||||
schedule: ->
|
||||
Ember.run.later((=> @tick()), @get('interval') || Travis.TICK_INTERVAL)
|
||||
setTimeout((=> @tick()), @get('interval') || Travis.TICK_INTERVAL)
|
||||
|
|
Loading…
Reference in New Issue
Block a user