mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-26 15:35:55 +03:00
[GH-ISSUE #605] How can I get worker name #2320
Labels
No labels
CLI
bug
designing
documentation
duplicate
enhancement
good first issue
good first issue
help wanted
idea
invalid
investigate
needs-more-info
performance
pr-welcome
pull-request
question
wontfix
work in progress
work in progress
work-around-available
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asynq#2320
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tracydzf on GitHub (Jan 12, 2023).
Original GitHub issue: https://github.com/hibiken/asynq/issues/605
excuse me! i want to get woker name in handler.Becauese i want to log which is woking,who exec this task.
@hibiken
tasks.Logger.With().Str("task_id", taskId).Str("task_type", t.Type()).Logger()@tracydzf commented on GitHub (Jan 12, 2023):
@hibiken
@tracydzf commented on GitHub (Jan 13, 2023):
i kown i can use os.hostname and os.PID。but i want get worker uuid。

thanks
@linhbkhn95 commented on GitHub (Feb 14, 2023):
Currently, asynq only stores workerInfo as additional information. It's really not action performed.
worker is goroutine with ID is msgID
h.workers[w.msg.ID] = wCan you provide the specific use case for your issue?
@zss007 commented on GitHub (Mar 17, 2023):
For example, I need to send a message to a specific worker.
And now have to make sure the hostname is different. If i can get serverID's value, then hostname can be the same.
@linhbkhn95 commented on GitHub (Mar 17, 2023):
mux.HandleFunc(currWorker, tasks.HandleSystemTask)you mean?HandleFuncis used to set up taskType with a task handler that will have a specific schema per task. A specific handler should handle it.@zss007 commented on GitHub (Mar 17, 2023):
All for send a message to a specific server, so define a special task type.
Then client can send message to this server, and other servers will not handle it.
So if i can get serverID, it's better.
@linhbkhn95 commented on GitHub (Mar 17, 2023):
Then client can send message to this server, and other servers will not handle it.?I really have not understood you. Low-level, tasks are stored in Redis, They will be distributed to multi workers via Redis.
I really curious that why do you need that info?
@zss007 commented on GitHub (Mar 17, 2023):
For example, now I want to update the server code, which may run on windows or linux, and each server must only receive an update message once