diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-05 03:57:21 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-05 03:57:21 +0900 |
| commit | 296aa3f8a145a8fbc08db9f5b1d45fe6f72a38a4 (patch) | |
| tree | 11180e08e96e1adb492b3aa52d32edd79a669711 /backend/taskqueue/processor.go | |
| parent | 9ff9c151e5defd9eed5cba3c88bc341b4360d09c (diff) | |
| download | iosdc-japan-2025-albatross-296aa3f8a145a8fbc08db9f5b1d45fe6f72a38a4.tar.gz iosdc-japan-2025-albatross-296aa3f8a145a8fbc08db9f5b1d45fe6f72a38a4.tar.zst iosdc-japan-2025-albatross-296aa3f8a145a8fbc08db9f5b1d45fe6f72a38a4.zip | |
feat: implement task queue
Diffstat (limited to 'backend/taskqueue/processor.go')
| -rw-r--r-- | backend/taskqueue/processor.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/backend/taskqueue/processor.go b/backend/taskqueue/processor.go new file mode 100644 index 0000000..e26ac64 --- /dev/null +++ b/backend/taskqueue/processor.go @@ -0,0 +1,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{} +} |
