Skip to content

Commit

Permalink
fix: add missing task id
Browse files Browse the repository at this point in the history
  • Loading branch information
WangYihang committed Apr 11, 2024
1 parent 15e9534 commit fa1f3b4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions task.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package gojob

import "github.com/google/uuid"

// Task is an interface that defines a task
type Task interface {
// Do starts the task, returns error if failed
Expand All @@ -10,6 +12,7 @@ type Task interface {

type BasicTask struct {
Index int64 `json:"index"`
RunID string `json:"run_id"`
ID string `json:"id"`
StartedAt int64 `json:"started_at"`
FinishedAt int64 `json:"finished_at"`
Expand All @@ -18,10 +21,11 @@ type BasicTask struct {
Error string `json:"error"`
}

func NewBasicTask(index int64, id string, task Task) *BasicTask {
func NewBasicTask(index int64, runID string, task Task) *BasicTask {
return &BasicTask{
Index: index,
ID: id,
RunID: runID,
ID: uuid.New().String(),
StartedAt: 0,
FinishedAt: 0,
NumTries: 0,
Expand Down

0 comments on commit fa1f3b4

Please sign in to comment.