From d014303617036a9ac6effa2459a19d52c8d51202 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Mon, 15 Apr 2024 20:40:16 +0200 Subject: [PATCH] use wlock when delivering message about new mox version --- serve_unix.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/serve_unix.go b/serve_unix.go index 0b34fbb..cc44245 100644 --- a/serve_unix.go +++ b/serve_unix.go @@ -335,10 +335,16 @@ Only implemented on unix systems, not Windows. return next } m.Size = int64(n) - if err := a.DeliverMailbox(log, mox.Conf.Static.Postmaster.Mailbox, &m, f); err != nil { - log.Errorx("changelog delivery", err) + + var derr error + a.WithWLock(func() { + derr = a.DeliverMailbox(log, mox.Conf.Static.Postmaster.Mailbox, &m, f) + }) + if derr != nil { + log.Errorx("changelog delivery", derr) return next } + log.Info("delivered changelog", slog.Any("current", current), slog.Any("lastknown", lastknown),