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:
parent
ee9f9d934c
commit
2723ae5c06
|
@ -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)
|
||||
|
|
|
@ -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(':')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user