more
Build and Publish / BuildAndDeployArm64 (push) Failing after 5s
Build and Publish / BuildAndDeployAmd64 (push) Has been cancelled

This commit is contained in:
2026-06-21 23:47:53 +02:00
parent 9d420c43fa
commit a1f0bad972
5 changed files with 38 additions and 24 deletions
+7
View File
@@ -23,6 +23,7 @@ import (
"errors"
"log/slog"
"os"
"path/filepath"
"sort"
"sync"
"time"
@@ -144,6 +145,12 @@ func (o *Outbox) compact() error {
if err := os.Rename(tmp, o.path); err != nil {
return err
}
// fsync the directory so the rename (the file swap) is itself durable — a
// crash right after must not leave the pending log lost or a stale .tmp.
if d, derr := os.Open(filepath.Dir(o.path)); derr == nil {
_ = d.Sync()
_ = d.Close()
}
o.f, err = os.OpenFile(o.path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o644)
return err
}