This commit is contained in:
Daniel 2023-12-05 17:51:17 +08:00
parent 4347d12af0
commit b1cea465ac
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
8 changed files with 31 additions and 35 deletions

View file

@ -23,7 +23,6 @@ import (
"math/rand"
"os"
"path/filepath"
"reflect"
"runtime"
"runtime/debug"
"strings"
@ -85,11 +84,6 @@ func logBootInfo() {
Ver, runtime.GOARCH, plat, os.Getpid(), Mode, WorkingDir, ReadOnly, Container, DatabaseVer, WorkspaceDir)
}
func IsMutexLocked(m *sync.Mutex) bool {
state := reflect.ValueOf(m).Elem().FieldByName("state")
return state.Int()&1 == 1
}
func RandomSleep(minMills, maxMills int) {
r := gulu.Rand.Int(minMills, maxMills)
time.Sleep(time.Duration(r) * time.Millisecond)
@ -177,7 +171,7 @@ func CheckFileSysStatus() {
func checkFileSysStatus() {
defer logging.Recover()
if IsMutexLocked(&checkFileSysStatusLock) {
if gulu.IsMutexLocked(&checkFileSysStatusLock) {
logging.LogWarnf("check file system status is locked, skip")
return
}