From ec3a8e5444e627a012297ad52c729911714d2f1a Mon Sep 17 00:00:00 2001 From: WilliButz Date: Sun, 15 Apr 2018 15:47:06 +0200 Subject: [PATCH] fix non-updating metrics from systemd-journal fixes #10 where metrics metrics collected from the systemd journal were not updated after some time --- postfix_exporter.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/postfix_exporter.go b/postfix_exporter.go index eb2b679..d0c6893 100644 --- a/postfix_exporter.go +++ b/postfix_exporter.go @@ -409,6 +409,10 @@ func (e *PostfixExporter) CollectLogfileFromJournal() error { e.journal.Lock() defer e.journal.Unlock() + r := e.journal.Wait(time.Duration(1) * time.Second) + if r < 0 { + log.Print("error while waiting for journal!") + } for { m, c, err := e.journal.NextMessage() if err != nil {