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: