From 17f2d05cded9dee2cece0a4e9c5e49d9ad02e845 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 14 Jul 2020 11:25:50 -0700 Subject: [PATCH] filer: ensure logs are persisted --- weed/filer2/filer_notify.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/weed/filer2/filer_notify.go b/weed/filer2/filer_notify.go index 340f19fb5..e5f9eba0a 100644 --- a/weed/filer2/filer_notify.go +++ b/weed/filer2/filer_notify.go @@ -78,8 +78,13 @@ func (f *Filer) logFlushFunc(startTime, stopTime time.Time, buf []byte) { // startTime.Second(), startTime.Nanosecond(), ) - if err := f.appendToFile(targetFile, buf); err != nil { - glog.V(0).Infof("log write failed %s: %v", targetFile, err) + for { + if err := f.appendToFile(targetFile, buf); err != nil { + glog.V(1).Infof("log write failed %s: %v", targetFile, err) + time.Sleep(737 * time.Millisecond) + } else { + break + } } }