Skip to content

Commit

Permalink
pkg/reloader: use watchInterval timeout for initial apply (thanos-io#…
Browse files Browse the repository at this point in the history
…6519)

* pkg/reloader: use watchInterval timeout for initial apply

Signed-off-by: Craig Peterson <[email protected]>

* changelog

Signed-off-by: Craig Peterson <[email protected]>

* use distinct context for initial sync

Signed-off-by: Craig Peterson <[email protected]>

---------

Signed-off-by: Craig Peterson <[email protected]>
  • Loading branch information
captncraig authored and GiedriusS committed Jul 27, 2023
1 parent 295dba9 commit 39662b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#6325](https://github.com/thanos-io/thanos/pull/6325) Store: return gRPC resource exhausted error for byte limiter.
- [#6399](https://github.com/thanos-io/thanos/pull/6399) *: Fix double-counting bug in http_request_duration metric
- [#6428](https://github.com/thanos-io/thanos/pull/6428) Report gRPC connnection errors in the logs.
- [#6519](https://github.com/thanos-io/thanos/pull/6519) Reloader: Use timeout for initial apply.
- [#6509](https://github.com/thanos-io/thanos/pull/6509) Store Gateway: Remove `memWriter` from `fileWriter` to reduce memory usage when sync index headers.

### Changed
Expand Down
6 changes: 4 additions & 2 deletions pkg/reloader/reloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,10 @@ func (r *Reloader) Watch(ctx context.Context) error {
if err := r.watcher.addFile(r.cfgFile); err != nil {
return errors.Wrapf(err, "add config file %s to watcher", r.cfgFile)
}

if err := r.apply(ctx); err != nil {
initialSyncCtx, initialSyncCancel := context.WithTimeout(ctx, r.watchInterval)
err := r.apply(initialSyncCtx)
initialSyncCancel()
if err != nil {
return err
}
}
Expand Down

0 comments on commit 39662b7

Please sign in to comment.