MCPcopy Create free account
hub / github.com/Azure/peerd / delay

Function delay

tests/random/random.go:267–282  ·  view source on GitHub ↗
(l *zerolog.Logger)

Source from the content-addressed store, hash-verified

265}
266
267func delay(l *zerolog.Logger) {
268 var n uint64
269 err := binary.Read(rand.Reader, binary.LittleEndian, &n)
270 if err != nil {
271 l.Error().Err(err).Msg("SLEEP FAILED")
272 return
273 }
274
275 n = n % 100
276 n = n + 1
277
278 l.Info().Uint64("seconds", n).Msg("sleeping")
279
280 // Sleep for n seconds
281 time.Sleep(time.Duration(n) * time.Second)
282}

Callers 1

RandomFunction · 0.85

Calls 1

ReadMethod · 0.65

Tested by

no test coverage detected