From 4ff524faccc505523ecdf6a8b123c77b8c45031a Mon Sep 17 00:00:00 2001 From: Alex Gaetano Padula Date: Tue, 5 Nov 2024 15:50:56 -0500 Subject: [PATCH] pager: on Close method ensure all writes are flushed to disk via escalation --- pager/pager.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pager/pager.go b/pager/pager.go index 7f219b0..5e95ac2 100644 --- a/pager/pager.go +++ b/pager/pager.go @@ -248,6 +248,11 @@ func (p *Pager) Close() error { p.wg.Wait() + // Ensure all pending writes are flushed to disk + if err := p.file.Sync(); err != nil { + return err + } + if p != nil { return p.file.Close() }