hibiken / asynq

Simple, reliable, and efficient distributed task queue in Go
MIT License
10.03k stars 716 forks source link

[QUESTION] How to access task ID within a task? #960

Closed fargusplumdoodle closed 2 weeks ago

fargusplumdoodle commented 2 weeks ago

ChatGPT keeps trying to reference t.ID() from the *asynq.Task, but that is not an option. Was this removed?

I am hoping to include the Task ID in my logs.

Sorry about the bug label, I don't think this is a bug.

Version I am running 24.1

yousifh commented 2 weeks ago

You should be able to use asynq.GetTaskID(ctx) in your handler code to get the task ID.