diff --git a/maloja/database/cached.py b/maloja/database/cached.py index 4aea767..7967665 100644 --- a/maloja/database/cached.py +++ b/maloja/database/cached.py @@ -1,7 +1,7 @@ # for information that is not authorative, but should be saved anyway because it # changes infrequently and DB access is expensive -from doreah.regular import yearly, daily +from doreah.regular import runyearly, rundaily from .. import database from .. import malojatime as mjt @@ -17,7 +17,7 @@ medals_tracks = { weekly_topartists = [] weekly_toptracks = [] -@yearly +@runyearly def update_medals(): global medals_artists, medals_tracks @@ -48,7 +48,7 @@ def update_medals(): -@daily +@rundaily def update_weekly(): global weekly_topartists, weekly_toptracks diff --git a/maloja/database/dbcache.py b/maloja/database/dbcache.py index 89baea0..ed93eb2 100644 --- a/maloja/database/dbcache.py +++ b/maloja/database/dbcache.py @@ -18,12 +18,6 @@ entitycache = lru.LRU(HIGH_NUMBER) hits, misses = 0, 0 -if malojaconfig['USE_GLOBAL_CACHE']: - log("Using global DB Cache") -if malojaconfig['USE_REQUEST_CACHE']: - log("Using request-local DB Cache") - - @runhourly def maintenance(): @@ -118,7 +112,7 @@ def trim_cache(): ramprct = psutil.virtual_memory().percent if ramprct > malojaconfig["DB_MAX_MEMORY"]: log(f"{ramprct}% RAM usage, reducing caches!") - ratio = (ramprct/100) ** 3 + ratio = 0.6 targetsize = max(int(len(cache) * ratio),100) cache.set_size(targetsize) cache.set_size(HIGH_NUMBER) diff --git a/maloja/globalconf.py b/maloja/globalconf.py index 135da01..d4d8b70 100644 --- a/maloja/globalconf.py +++ b/maloja/globalconf.py @@ -300,9 +300,6 @@ with open(pthj(dir_settings['state'],".lastmalojaversion"),"w") as filed: from doreah import config config( - caching={ - "folder": data_dir['cache']() - }, auth={ "multiuser":False, "cookieprefix":"maloja", @@ -313,7 +310,6 @@ config( "logfolder": data_dir['logs']() if malojaconfig["LOGGING"] else None }, regular={ - "autostart": False, "offset": malojaconfig["TIMEZONE"] } ) diff --git a/maloja/server.py b/maloja/server.py index 5f6752b..5975a39 100644 --- a/maloja/server.py +++ b/maloja/server.py @@ -35,7 +35,7 @@ from .proccontrol.profiler import profile PORT = malojaconfig["PORT"] HOST = malojaconfig["HOST"] -THREADS = 8 +THREADS = 12 BaseRequest.MEMFILE_MAX = 15 * 1024 * 1024 #STATICFOLDER = importlib.resources.path(__name__,"web/static")