From 9a6cfd21dbabe52f863dfdba9a08baa43b67cb26 Mon Sep 17 00:00:00 2001 From: Samiur A Date: Wed, 11 Dec 2019 09:51:24 -0700 Subject: [PATCH] Doing an initial synch and then sleep to space out subsequent cycles. #1618 (#1900) Signed-off-by: Samiur Arif --- table_manager.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/table_manager.go b/table_manager.go index d07a9f4a66f4d..eba9b23f3587a 100644 --- a/table_manager.go +++ b/table_manager.go @@ -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() @@ -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: