From edb4e1930954862ee60b0bcfb294c1159a279f40 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 5 Dec 2013 17:12:22 +0100 Subject: [PATCH] Run lastBuildDidChange only once for a runloop run When a lot of pusher events come with build updates, lastBuildDidChange can run quite frequently. We can avoid that by using scheduleOnce, which will ensure that only the last invocation of lastBuildDidChange will be run for a given runloop run. --- assets/scripts/app/controllers/repo.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assets/scripts/app/controllers/repo.coffee b/assets/scripts/app/controllers/repo.coffee index 5b326071..88276d71 100644 --- a/assets/scripts/app/controllers/repo.coffee +++ b/assets/scripts/app/controllers/repo.coffee @@ -50,6 +50,9 @@ Travis.RepoController = Travis.Controller.extend @connectTab('job') lastBuildDidChange: -> + Ember.run.scheduleOnce('data', this, @_lastBuildDidChange); + + _lastBuildDidChange: -> build = @get('repo.lastBuild') @set('build', build)