mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 13:57:36 -08:00
remote/storage.go: adjust Storage.Notify() to avoid a race condition with Storage.ApplyConfig()
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
This commit is contained in:
parent
08c17df244
commit
413b713aa8
|
@ -77,10 +77,7 @@ func NewStorage(l log.Logger, reg prometheus.Registerer, stCallback startTimeCal
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) Notify() {
|
func (s *Storage) Notify() {
|
||||||
for _, q := range s.rws.queues {
|
s.rws.Notify()
|
||||||
// These should all be non blocking
|
|
||||||
q.watcher.Notify()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ApplyConfig updates the state as the new config requires.
|
// ApplyConfig updates the state as the new config requires.
|
||||||
|
|
|
@ -121,6 +121,16 @@ func (rws *WriteStorage) run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (rws *WriteStorage) Notify() {
|
||||||
|
rws.mtx.Lock()
|
||||||
|
defer rws.mtx.Unlock()
|
||||||
|
|
||||||
|
for _, q := range rws.queues {
|
||||||
|
// These should all be non blocking
|
||||||
|
q.watcher.Notify()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ApplyConfig updates the state as the new config requires.
|
// ApplyConfig updates the state as the new config requires.
|
||||||
// Only stop & create queues which have changes.
|
// Only stop & create queues which have changes.
|
||||||
func (rws *WriteStorage) ApplyConfig(conf *config.Config) error {
|
func (rws *WriteStorage) ApplyConfig(conf *config.Config) error {
|
||||||
|
|
Loading…
Reference in a new issue