From 1a59d03a0cb910942107b0da2615f426fe8ac4bb Mon Sep 17 00:00:00 2001 From: Antonio Navarro Perez Date: Thu, 16 Dec 2021 12:13:47 -0800 Subject: [PATCH] Use a smaller badger log file size to be compatible with 32 bit systems (#108) --- torrent/loader/db.go | 7 ++++++- torrent/store.go | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/torrent/loader/db.go b/torrent/loader/db.go index 4d21db8..a2235df 100644 --- a/torrent/loader/db.go +++ b/torrent/loader/db.go @@ -19,7 +19,12 @@ type DB struct { func NewDB(path string) (*DB, error) { l := log.Logger.With().Str("component", "torrent-store").Logger() - db, err := badger.Open(badger.DefaultOptions(path).WithLogger(&dlog.Badger{L: l})) + + opts := badger.DefaultOptions(path). + WithLogger(&dlog.Badger{L: l}). + WithValueLogFileSize(1<<26 - 1) + + db, err := badger.Open(opts) if err != nil { return nil, err } diff --git a/torrent/store.go b/torrent/store.go index 70f5aba..9f8058b 100644 --- a/torrent/store.go +++ b/torrent/store.go @@ -20,7 +20,12 @@ type FileItemStore struct { func NewFileItemStore(path string, itemsTTL time.Duration) (*FileItemStore, error) { l := log.Logger.With().Str("component", "item-store").Logger() - db, err := badger.Open(badger.DefaultOptions(path).WithLogger(&dlog.Badger{L: l})) + + opts := badger.DefaultOptions(path). + WithLogger(&dlog.Badger{L: l}). + WithValueLogFileSize(1<<26 - 1) + + db, err := badger.Open(opts) if err != nil { return nil, err }