Skip to content

Commit

Permalink
Doing an initial synch and then sleep to space out subsequent cycles. g…
Browse files Browse the repository at this point in the history
…rafana#1618 (grafana#1900)

Signed-off-by: Samiur Arif <[email protected]>
  • Loading branch information
tcl00taco authored and csmarchbanks committed Dec 11, 2019
1 parent 41684a5 commit 9a6cfd2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions table_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,6 @@ func (m *TableManager) Stop() {
func (m *TableManager) loop() {
defer m.wait.Done()

// Sleep for a bit to spread the sync load across different times if the tablemanagers are all started at once.
time.Sleep(time.Duration(rand.Int63n(int64(m.cfg.DynamoDBPollInterval))))

ticker := time.NewTicker(m.cfg.DynamoDBPollInterval)
defer ticker.Stop()

Expand All @@ -179,6 +176,9 @@ func (m *TableManager) loop() {
level.Error(util.Logger).Log("msg", "error syncing tables", "err", err)
}

// Sleep for a bit to spread the sync load across different times if the tablemanagers are all started at once.
time.Sleep(time.Duration(rand.Int63n(int64(m.cfg.DynamoDBPollInterval))))

for {
select {
case <-ticker.C:
Expand Down

0 comments on commit 9a6cfd2

Please sign in to comment.