diff --git a/internal/utils/singleton.go b/internal/utils/singleton.go index 55e44193e..c67da712f 100644 --- a/internal/utils/singleton.go +++ b/internal/utils/singleton.go @@ -14,19 +14,19 @@ type UniqueValidatorID struct { uniqueID uint32 } -var instance *UniqueValidatorID +var validatorIDInstance *UniqueValidatorID var logInstance log.Logger -var once sync.Once +var onceForUniqueValidatorID sync.Once var onceForLog sync.Once // GetUniqueValidatorIDInstance returns a singleton instance func GetUniqueValidatorIDInstance() *UniqueValidatorID { - once.Do(func() { - instance = &UniqueValidatorID{ + onceForUniqueValidatorID.Do(func() { + validatorIDInstance = &UniqueValidatorID{ uniqueID: 0, } }) - return instance + return validatorIDInstance } // GetUniqueID returns a unique ID and increment the internal variable