Skip to content

Commit

Permalink
Add lock_time tostart_job log
Browse files Browse the repository at this point in the history
  • Loading branch information
winebarrel committed Nov 13, 2024
1 parent d9d589f commit 59b5603
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func (w *Worker) Work() {

// WorkOne work on job
func (w *Worker) WorkOne() (didWork bool) {
startTime := time.Now()
j, err := w.c.LockJob(w.Queue)
if err != nil {
log.Printf("attempting to lock job: %v", err)
Expand All @@ -103,7 +104,7 @@ func (w *Worker) WorkOne() (didWork bool) {
if j == nil {
return // no job was available
}
log.Printf("event=start_job job_id=%d job_type=%s", j.ID, j.Type)
log.Printf("event=start_job job_id=%d job_type=%s lock_time=%d", j.ID, j.Type, time.Since(startTime).Milliseconds())
j.tx, err = j.c.pool.Begin()
if err != nil {
log.Printf("failed to create transaction: %v", err)
Expand Down

0 comments on commit 59b5603

Please sign in to comment.