contribsys / faktory_worker_ruby

Faktory worker for Ruby
GNU Lesser General Public License v3.0
214 stars 31 forks source link

Track Status is being reported as "unknown" #77

Closed jonathan-wondereur closed 1 year ago

jonathan-wondereur commented 1 year ago

Using track status reports status as "unknown" whereas using track status from Go is reporting the correct status.

mperham commented 1 year ago

Can you show me the code and the response from each environment? I just added a test for get_track in FWR and it appears to work as expected. Version numbers would also help.

jonathan-wondereur commented 1 year ago

Track Set from background process written in Go

err := help.With(func(cl *faktory.Client) error {
  exp := time.Now().Add(24 * time.Hour)
  return cl.TrackSet(
      help.Jid(),
      progress,
      status,
      &exp,
  )
})

Track Get Go Test

log.Print(client.TrackGet(job.Jid))
>> 2023/05/18 14:00:07 &{7Woa6Z2qNQBdT9ko 0  enqueued 2023-05-18T16:30:07.405904672Z} <nil>

Track output from Rails (where job is enqueued from & track status is needed)

# Get the job status from faktory
c = Faktory::Client.new
status = c.get_track(policy_analysis.job_id)
puts "-------------------------------------------"
puts status
puts "-------------------------------------------"

prints...

rails-api-api-1             | -------------------------------------------
rails-api-api-1             | {"jid"=>"afd0c6c7dd1d8b3ac4ecbaea", "percent"=>100, "desc"=>"COMPLETE", "state"=>"unknown", "updated_at"=>"2023-05-18T13:16:32.649216796Z"}
rails-api-api-1             | -------------------------------------------
mperham commented 1 year ago

Is it possible it's a job which does not have track:1 set in its custom properties?

https://github.com/contribsys/faktory/wiki/Ent-Tracking#the-dreaded-unknown-job-state

jonathan-wondereur commented 1 year ago

Yes, that was the issue; sorry for the bother.