Skip to content

Commit 5d803f2

Browse files
committed
randomize periodic indexing interval
Signed-off-by: mkozjak <kozjakm1@gmail.com>
1 parent bba4408 commit 5d803f2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gorecord.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"gopkg.in/ini.v1"
1414
"io"
1515
"log"
16+
"math/rand"
1617
"net"
1718
"net/rpc"
1819
"net/rpc/jsonrpc"
@@ -833,7 +834,9 @@ func Recorder(iface *net.Interface, recdir, filename, mcast, port, stype string,
833834
log.Println("Recording asset:", filename)
834835

835836
// Set periodic indexing
836-
ticker := time.NewTicker(time.Minute)
837+
rand.Seed(time.Now().Unix())
838+
839+
ticker := time.NewTicker(time.Second * time.Duration((rand.Intn(90-60) + 60)))
837840
go func() {
838841
for _ = range ticker.C {
839842
runCh <- "index"

0 commit comments

Comments
 (0)