mirror of https://github.com/prometheus/prometheus
Check nil err first when committing (#12625)
The most common case is to have a nil error when appending series, so let's check that first instead of checking the 3 error types first. Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>pull/12635/head
parent
f26dfc95e6
commit
cd7d0b69a2
|
@ -930,6 +930,8 @@ func (a *headAppender) Commit() (err error) {
|
|||
|
||||
oooSample, _, err := series.appendable(s.T, s.V, a.headMaxt, a.minValidTime, a.oooTimeWindow)
|
||||
switch err {
|
||||
case nil:
|
||||
// Do nothing.
|
||||
case storage.ErrOutOfOrderSample:
|
||||
samplesAppended--
|
||||
oooRejected++
|
||||
|
@ -939,8 +941,6 @@ func (a *headAppender) Commit() (err error) {
|
|||
case storage.ErrTooOldSample:
|
||||
samplesAppended--
|
||||
tooOldRejected++
|
||||
case nil:
|
||||
// Do nothing.
|
||||
default:
|
||||
samplesAppended--
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue