1
This commit is contained in:
parent
9c2949041a
commit
85cacf770e
14
app.go
14
app.go
@ -19,6 +19,7 @@ type App interface {
|
||||
GetPkgName() string
|
||||
NewGlobalUuid() string
|
||||
NewNodeUuid() int64
|
||||
NewLockNodeUuid() int64
|
||||
GetInstanceId() int32
|
||||
GetNodeId() int32
|
||||
GetZoneId() int32
|
||||
@ -29,6 +30,7 @@ type App interface {
|
||||
GetNowSeconds() int64
|
||||
GetNowMillis() int64
|
||||
GetNowNano() int64
|
||||
GetRealSeconds() int64
|
||||
GetTimeOffset() int32
|
||||
SetTimeOffset(int32)
|
||||
GetLocation() *time.Location
|
||||
@ -74,6 +76,8 @@ type app struct {
|
||||
maxRunDelay int64
|
||||
maxScheduleTime int64
|
||||
uuid q5.Uuid
|
||||
lockUuid q5.Uuid
|
||||
uuidMutex sync.RWMutex
|
||||
userApp UserApp
|
||||
ginEngine *gin.Engine
|
||||
ormDbLock sync.Mutex
|
||||
@ -195,6 +199,12 @@ func (this *app) NewNodeUuid() int64 {
|
||||
return this.uuid.Generate()
|
||||
}
|
||||
|
||||
func (this *app) NewLockNodeUuid() int64 {
|
||||
defer this.uuidMutex.Unlock()
|
||||
this.uuidMutex.Lock()
|
||||
return this.lockUuid.Generate()
|
||||
}
|
||||
|
||||
func (this *app) GetInstanceId() int32 {
|
||||
return this.instanceId
|
||||
}
|
||||
@ -287,6 +297,10 @@ func (this *app) GetNowNano() int64 {
|
||||
return this.nowUnixNano
|
||||
}
|
||||
|
||||
func (this *app) GetRealSeconds() int64 {
|
||||
return time.Now().UnixNano() / int64(time.Millisecond)
|
||||
}
|
||||
|
||||
func (this *app) GetTimeOffset() int32 {
|
||||
return this.timeOffset
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user