X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/e754189bc2aa32ec43a5dc4ee01d7a6c6e4e388c..4e3341f81d4c9b296c8fd016f4a086752d561efd:/journal.go?ds=inline diff --git a/journal.go b/journal.go index 3c2a7ef..a962011 100644 --- a/journal.go +++ b/journal.go @@ -18,7 +18,8 @@ type journal struct { day string } -// Write appends line to the file of day and flushes it to the disk. +// Write appends line to the file of day with one write to the operating system, +// without a buffer. A crash of the process then loses nothing. func (j *journal) Write(day string, line []byte) error { if day != j.day { err := j.Close() @@ -39,11 +40,6 @@ func (j *journal) Write(day string, line []byte) error { return fmt.Errorf("write line: %w", err) } - err = j.file.Sync() - if err != nil { - return fmt.Errorf("flush line: %w", err) - } - return nil }