Browse Source

sklad: sync the database log

master
Přemysl Janouch 1 year ago
parent
commit
401ed71323
Signed by: Přemysl Janouch <p@janouch.name> GPG Key ID: A0420B94F92B9493
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      sklad/db.go

+ 4
- 2
sklad/db.go View File

@@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io"
"os"
)

@@ -37,7 +36,7 @@ var (
dbPath string
db Database
dbLast Database
dbLog io.Writer
dbLog *os.File

indexSeries = map[string]*Series{}
indexContainer = map[ContainerId]*Container{}
@@ -58,6 +57,9 @@ func dbCommit() error {
if err := e.Encode(&dbLast); err != nil {
return err
}
if err := dbLog.Sync(); err != nil {
return err
}

// Atomically replace the current database file.
tempPath := dbPath + ".new"

Loading…
Cancel
Save