diff --git a/go.mod b/go.mod index 298ac06..5c76bcb 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ module github.com/studiolambda/yotei go 1.22.0 + +require github.com/google/uuid v1.6.0 // indirect diff --git a/task.go b/task.go index 20c06ef..61327b2 100644 --- a/task.go +++ b/task.go @@ -5,6 +5,8 @@ import ( "fmt" "sync/atomic" "time" + + "github.com/google/uuid" ) // Task is the the executionable action in the [Scheduler]. @@ -51,6 +53,9 @@ func NewTask(handler Handler) *Task { task.duration.Store(int64(DurationUnlimited)) task.concurrent.Store(false) + id, _ := uuid.NewV7() + task.id.Store(id.String()) + return task }