Find job for clearing logs only if it's already in store

Otherwise we make ajax request every time job is created.
This commit is contained in:
Piotr Sarnacki 2013-01-23 22:08:17 +01:00
parent ee9f9d934c
commit 2723ae5c06
2 changed files with 5 additions and 2 deletions

View File

@ -41,8 +41,8 @@ $.extend Travis.Pusher.prototype,
# TODO remove job:requeued, once sf-restart-event has been merged
# TODO this also needs to clear logs on build:created if matrix jobs are already loaded
if event == 'job:created' || event == 'job:requeued'
job = Travis.Job.find(data.job.id)
job.clearLog() if job
if Travis.store.isInStore(Travis.Job, data.job.id)
Travis.Job.find(data.job.id).clearLog()
Ember.run.next ->
Travis.app.store.receive(event, data)

View File

@ -67,6 +67,9 @@ Travis.Store = DS.Store.extend
{ id: id, clientId: clientId }
isInStore: (type, id) ->
!!@typeMapFor(type).idToCid[id]
receive: (event, data) ->
[name, type] = event.split(':')