| 170 | } |
| 171 | |
| 172 | func (rep *Reporter) init(ctx context.Context) { |
| 173 | ctx, span := tracer.Start(ctx, "UsageReporter.init") |
| 174 | defer span.End() |
| 175 | |
| 176 | if rep.conf.Leader { |
| 177 | rep.cluster = rep.initLeader(ctx) |
| 178 | return |
| 179 | } |
| 180 | // follower only wait for the cluster seed to be set. |
| 181 | // it will try forever to fetch the cluster seed. |
| 182 | seed, _ := rep.fetchSeed(ctx, nil) |
| 183 | rep.cluster = seed |
| 184 | } |
| 185 | |
| 186 | // fetchSeed fetches the cluster seed from the object store and try until it succeeds. |
| 187 | // continueFn allow you to decide if we should continue retrying. Nil means always retry |