refactor: use atomic.Int64 for underlying GetId implementation

This commit is contained in:
2025-08-01 16:27:39 -05:00
parent 393191ccb5
commit 378bc29e7e

View File

@@ -5,6 +5,7 @@ import (
"log/slog"
"reflect"
"runtime"
"sync/atomic"
"time"
"github.com/golang-module/carbon"
@@ -16,11 +17,12 @@ type EnabledDisabledInfo struct {
RunOnError bool
}
var id int64 = 0
var (
id atomic.Int64 // default value is 0
)
func GetId() int64 {
id += 1
return id
return id.Add(1)
}
// Parses a HH:MM string.