Use a smaller badger log file size to be compatible with 32 bit systems (#108)

This commit is contained in:
Antonio Navarro Perez 2021-12-16 12:13:47 -08:00 committed by GitHub
parent 64a12d1780
commit 1a59d03a0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -19,7 +19,12 @@ type DB struct {
func NewDB(path string) (*DB, error) { func NewDB(path string) (*DB, error) {
l := log.Logger.With().Str("component", "torrent-store").Logger() 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 { if err != nil {
return nil, err return nil, err
} }

View file

@ -20,7 +20,12 @@ type FileItemStore struct {
func NewFileItemStore(path string, itemsTTL time.Duration) (*FileItemStore, error) { func NewFileItemStore(path string, itemsTTL time.Duration) (*FileItemStore, error) {
l := log.Logger.With().Str("component", "item-store").Logger() 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 { if err != nil {
return nil, err return nil, err
} }