1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added log output to cache trimming

This commit is contained in:
krateng 2022-04-10 23:26:03 +02:00
parent 2d2a7c2ee7
commit 5a2856a682
3 changed files with 6 additions and 4 deletions

View File

@ -4,7 +4,7 @@
# you know what f*ck it # you know what f*ck it
# this is hardcoded for now because of that damn project / package name discrepancy # this is hardcoded for now because of that damn project / package name discrepancy
# i'll fix it one day # i'll fix it one day
VERSION = "3.0.0-beta.4" VERSION = "3.0.0-beta.5"
HOMEPAGE = "https://github.com/krateng/maloja" HOMEPAGE = "https://github.com/krateng/maloja"

View File

@ -113,10 +113,12 @@ def trim_cache():
if ramprct > malojaconfig["DB_MAX_MEMORY"]: if ramprct > malojaconfig["DB_MAX_MEMORY"]:
log(f"{ramprct}% RAM usage, reducing caches!") log(f"{ramprct}% RAM usage, reducing caches!")
ratio = 0.6 ratio = 0.6
targetsize = max(int(len(cache) * ratio),100) targetsize = max(int(len(cache) * ratio),50)
log(f"Reducing to {targetsize} entries")
cache.set_size(targetsize) cache.set_size(targetsize)
cache.set_size(HIGH_NUMBER) cache.set_size(HIGH_NUMBER)
log(f"New RAM usage: {psutil.virtual_memory().percent}%") #log(f"New RAM usage: {psutil.virtual_memory().percent}%")
print_stats()

View File

@ -1,6 +1,6 @@
[project] [project]
name = "malojaserver" name = "malojaserver"
version = "3.0.0-beta.4" version = "3.0.0-beta.5"
description = "Self-hosted music scrobble database" description = "Self-hosted music scrobble database"
readme = "./README.md" readme = "./README.md"
requires-python = ">=3.6" requires-python = ">=3.6"