This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
packagetimer
import(
"fmt"
"math/rand"
"time"
"github.com/didi/nightingale/v5/cache"
"github.com/didi/nightingale/v5/models"
"github.com/toolkits/pkg/logger"
)
// userid->user 将数据库中的用户信息缓存在内存里,
// 在生成告警事件的时候,根据用户ID快速找到用户的详情
funcSyncUsers(){
err:=syncUsers()
iferr!=nil{
fmt.Println("timer: sync users fail:",err)
exit(1)
}
goloopSyncUsers()
}
funcloopSyncUsers(){
randtime:=rand.Intn(9000)
fmt.Printf("timer: sync users: random sleep %dms\n",randtime)