Refactor torrent manager
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/debridmediamanager.com/zurg/internal/torrent"
|
||||
"github.com/debridmediamanager.com/zurg/pkg/logutil"
|
||||
"github.com/hashicorp/golang-lru/v2/expirable"
|
||||
"github.com/nutsdb/nutsdb"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -25,9 +26,18 @@ func main() {
|
||||
log.Panicf("Config failed to load: %v", configErr)
|
||||
}
|
||||
|
||||
db, err := nutsdb.Open(
|
||||
nutsdb.DefaultOptions,
|
||||
nutsdb.WithDir("/tmp/nutsdb"),
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
cache := expirable.NewLRU[string, string](1e4, nil, time.Hour)
|
||||
|
||||
torrentMgr := torrent.NewTorrentManager(config, cache)
|
||||
torrentMgr := torrent.NewTorrentManager(config, cache, db)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
net.Router(mux, config, torrentMgr, cache)
|
||||
|
||||
Reference in New Issue
Block a user