Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request #116 from travis-ci/sf-notify-job-received
Browse files Browse the repository at this point in the history
Notify about job:received
  • Loading branch information
BanzaiMan committed Jan 26, 2015
2 parents 2dacdd0 + 66cb0ec commit 5a2f303
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/travis/worker/instance.rb
Expand Up @@ -90,6 +90,7 @@ def work(message, payload)
info "starting job slug:#{self.payload['repository']['slug']} id:#{self.payload['job']['id']}"
info "this is a requeued message" if message.redelivered?

notify_job_received
run_job

finish(message)
Expand Down Expand Up @@ -283,6 +284,10 @@ def timeout(type)
timeout.to_i
end

def notify_job_received
reporter.notify_job_received(self.payload['job']['id'])
end

def restart_job
if reporter && payload['job']['id']
info "requeuing job"
Expand Down
6 changes: 5 additions & 1 deletion lib/travis/worker/reporter.rb
Expand Up @@ -70,8 +70,12 @@ def send_last_log(job_id)
send_log(job_id, "", true)
end

def notify_job_received(job_id)
notify('job:test:receive', id: job_id, state: 'received', received_at: Time.now.utc, worker: Travis::Worker.config.hostname)
end

def notify_job_started(job_id)
notify('job:test:start', id: job_id, state: 'started', started_at: Time.now.utc)
notify('job:test:start', id: job_id, state: 'started', started_at: Time.now.utc)
end

def notify_job_finished(job_id, result)
Expand Down

0 comments on commit 5a2f303

Please sign in to comment.