[GH-ISSUE #573] handler not found for task #1289

Closed
opened 2026-03-07 22:08:20 +03:00 by kerem · 1 comment
Owner

Originally created by @charliecen on GitHub (Nov 15, 2022).
Original GitHub issue: https://github.com/hibiken/asynq/issues/573

Originally assigned to: @hibiken on GitHub.

After creating an asynchronous task queue, the browser prompts handler not found for task

my code

type ImageConvertTaskId struct {
	Tid string
}
const ImageConvertTask = "img:convert:task"

payload, _ := json.Marshal(ImageConvertTaskId{Tid: data.Tid})
_, err = l.svcCtx.AsynqClient.Enqueue(asynq.NewTask(ImageConvertTask, payload), asynq.MaxRetry(3), asynq.Timeout(3*time.Minute))
if err != nil {
	return err
}

// ProcessTask Process Queue Tasks
func (l *ImageTaskHandler) ProcessTask(ctx context.Context, t *asynq.Task) error {
	b := t.Payload()
	var p ImageConvertTaskId
	if err := json.Unmarshal(b, &p); err != nil {
		return err
	}
	resp, err := l.svcCtx.ConvertRpc.ConvertImage(l.ctx, &convert.ConvertImageReq{
		Tid: p.Tid,
	})
	if err != nil || resp == nil {
		return err
	}
	return nil
}

企业微信20221115-134045

# cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.15.0
PRETTY_NAME="Alpine Linux v3.15"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"

asynq: v0.23.0
Originally created by @charliecen on GitHub (Nov 15, 2022). Original GitHub issue: https://github.com/hibiken/asynq/issues/573 Originally assigned to: @hibiken on GitHub. After creating an asynchronous task queue, the browser prompts handler not found for task my code ```go type ImageConvertTaskId struct { Tid string } const ImageConvertTask = "img:convert:task" payload, _ := json.Marshal(ImageConvertTaskId{Tid: data.Tid}) _, err = l.svcCtx.AsynqClient.Enqueue(asynq.NewTask(ImageConvertTask, payload), asynq.MaxRetry(3), asynq.Timeout(3*time.Minute)) if err != nil { return err } // ProcessTask Process Queue Tasks func (l *ImageTaskHandler) ProcessTask(ctx context.Context, t *asynq.Task) error { b := t.Payload() var p ImageConvertTaskId if err := json.Unmarshal(b, &p); err != nil { return err } resp, err := l.svcCtx.ConvertRpc.ConvertImage(l.ctx, &convert.ConvertImageReq{ Tid: p.Tid, }) if err != nil || resp == nil { return err } return nil } ``` ![企业微信20221115-134045](https://user-images.githubusercontent.com/6268321/201835567-5f951dd3-9465-40c7-94f4-510a3bd5294b.png) ``` # cat /etc/os-release NAME="Alpine Linux" ID=alpine VERSION_ID=3.15.0 PRETTY_NAME="Alpine Linux v3.15" HOME_URL="https://alpinelinux.org/" BUG_REPORT_URL="https://bugs.alpinelinux.org/" asynq: v0.23.0 ```
kerem 2026-03-07 22:08:20 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@charliecen commented on GitHub (Nov 15, 2022):

// add queue name 
client.Enqueue(asynq.NewTask(ImageConvertTask, payload), asynq.Queue(TaskConvertQueueName), asynq.MaxRetry(TaskMaxRetry), asynq.Timeout(TaskTimeOut*time.Minute))

// queue priority
Queues: map[string]int{
  "convert": 2,
  "resize":  2,
  "default": 1,
  },

queue is ok

<!-- gh-comment-id:1315057055 --> @charliecen commented on GitHub (Nov 15, 2022): ```go // add queue name client.Enqueue(asynq.NewTask(ImageConvertTask, payload), asynq.Queue(TaskConvertQueueName), asynq.MaxRetry(TaskMaxRetry), asynq.Timeout(TaskTimeOut*time.Minute)) // queue priority Queues: map[string]int{ "convert": 2, "resize": 2, "default": 1, }, ``` queue is ok
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#1289
No description provided.