mirror of
https://github.com/prometheus/prometheus
synced 2025-01-13 02:14:08 +00:00
Merge pull request #693 from prometheus/fabxc/preload_timeout
Check context before each preloading.
This commit is contained in:
commit
4234a45d2e
@ -131,19 +131,21 @@ func (a *Analyzer) Prepare(ctx context.Context) (local.Preloader, error) {
|
||||
|
||||
// Preload all analyzed ranges.
|
||||
for offset, pt := range a.offsetPreloadTimes {
|
||||
if err = contextDone(ctx, env); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
start := a.Start.Add(-offset)
|
||||
end := a.End.Add(-offset)
|
||||
for fp, rangeDuration := range pt.ranges {
|
||||
if err = contextDone(ctx, env); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = p.PreloadRange(fp, start.Add(-rangeDuration), end, *stalenessDelta)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
for fp := range pt.instants {
|
||||
if err = contextDone(ctx, env); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = p.PreloadRange(fp, start, end, *stalenessDelta)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user