MCPcopy Create free account
hub / github.com/deepflowio/deepflow / randomSleep

Method randomSleep

server/controller/recorder/cache/cache.go:225–235  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

223}
224
225func (c *Cache) randomSleep() {
226 if c.Sequence == 0 {
227 return
228 }
229 // 生成 10-30 的随机数(对应 1.0-3.0 秒,粒度 0.1秒)
230 randomValue := rand.Intn(21) + 10 // 0-20 + 10 = 10-30
231 // 转换为 Duration(乘以 0.1秒 = 100毫秒)
232 duration := time.Duration(randomValue) * 100 * time.Millisecond
233 time.Sleep(duration)
234 log.Infof("cache refresh sleep %s", duration.String(), c.metadata.LogPrefixes)
235}
236
237// 所有缓存的刷新入口
238func (c *Cache) Refresh() {

Callers 1

RefreshMethod · 0.95

Calls 2

StringMethod · 0.65
InfofMethod · 0.45

Tested by

no test coverage detected