change log

This commit is contained in:
bryanqiu 2023-04-20 16:40:02 +08:00
parent cc94c074cc
commit 684d82f7bd

8
uid.go
View File

@ -100,8 +100,8 @@ func (idg *idCreator) backgroudTaskForGenerateRange() {
// doing range generator
for i := 0; ; i++ {
logStr := ""
log.SetLogid(fmt.Sprintf("uidcreator%07d", i))
log.PrintPretty("backgroud info, ranges:", idg.Ranges)
for prefix, queue := range idg.Ranges {
var qlen = queue.Len()
var timeoutMs = 1 * time.Millisecond
@ -120,6 +120,12 @@ func (idg *idCreator) backgroudTaskForGenerateRange() {
} else if int(timeoutMs) < 0 {
time.Sleep(-timeoutMs)
}
if i%50 == 0 {
logStr += fmt.Sprintf("queue-legth:(%s,%d);", prefix, queue.Len())
}
}
if i%50 == 0 {
log.Infof("backgroud idcreator info: %s", logStr)
}
time.Sleep(3000 * time.Millisecond)
}