aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/taskqueue/processor.go
blob: e26ac64c2c149b76da172c113a4355db48dddbcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package taskqueue

import (
	"context"
	"encoding/json"
	"fmt"

	"github.com/hibiken/asynq"
)

type ExecProcessor struct {
}

func (processor *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
	var payload TaskExecPlayload
	if err := json.Unmarshal(t.Payload(), &payload); err != nil {
		return fmt.Errorf("json.Unmarshal failed: %v: %w", err, asynq.SkipRetry)
	}
	// TODO
	return nil
}

func NewExecProcessor() *ExecProcessor {
	return &ExecProcessor{}
}