mirror of
https://github.com/prometheus/prometheus
synced 2024-12-27 17:13:22 +00:00
tsdb/wal: Avoid writing closed channel. (#9566)
Signed-off-by: johncming <johncming@yahoo.com>
This commit is contained in:
parent
d18e42c650
commit
b882d2b7c7
@ -472,6 +472,10 @@ func (w *WAL) NextSegment() error {
|
|||||||
|
|
||||||
// nextSegment creates the next segment and closes the previous one.
|
// nextSegment creates the next segment and closes the previous one.
|
||||||
func (w *WAL) nextSegment() error {
|
func (w *WAL) nextSegment() error {
|
||||||
|
if w.closed {
|
||||||
|
return errors.New("wal is closed")
|
||||||
|
}
|
||||||
|
|
||||||
// Only flush the current page if it actually holds data.
|
// Only flush the current page if it actually holds data.
|
||||||
if w.page.alloc > 0 {
|
if w.page.alloc > 0 {
|
||||||
if err := w.flushPage(true); err != nil {
|
if err := w.flushPage(true); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user