Fix mutexes in the cacher

This commit is contained in:
2026-02-12 02:28:23 +03:00
parent 2fbc12d770
commit f22111aa43
5 changed files with 36 additions and 11 deletions

View File

@@ -20,17 +20,18 @@ type Cacher struct {
transcoder domains.Transcoder
cacheDir string
cacheMutex sync.RWMutex
currentSize int64
maxSize int64
items map[string]*models.CacheItem
itemsMutex sync.RWMutex
stat map[string]*models.CacherStat
statMutex sync.RWMutex
}
func New(app *application.App) *Cacher {
return &Cacher{
app: app,
cacheDir: app.Config().Paths.Destination + "./.cache",
cacheDir: app.Config().Paths.Destination + "/.cache",
maxSize: app.Config().FakeTunes.CacheSize * 1024 * 1024,
items: make(map[string]*models.CacheItem, 0),
stat: make(map[string]*models.CacherStat, 0),