Various fixes

This commit is contained in:
krateng 2022-04-04 16:14:38 +02:00
parent b510e52188
commit acc08693b3
4 changed files with 5 additions and 15 deletions

View File

@ -1,7 +1,7 @@
# for information that is not authorative, but should be saved anyway because it # for information that is not authorative, but should be saved anyway because it
# changes infrequently and DB access is expensive # changes infrequently and DB access is expensive
from doreah.regular import yearly, daily from doreah.regular import runyearly, rundaily
from .. import database from .. import database
from .. import malojatime as mjt from .. import malojatime as mjt
@ -17,7 +17,7 @@ medals_tracks = {
weekly_topartists = [] weekly_topartists = []
weekly_toptracks = [] weekly_toptracks = []
@yearly @runyearly
def update_medals(): def update_medals():
global medals_artists, medals_tracks global medals_artists, medals_tracks
@ -48,7 +48,7 @@ def update_medals():
@daily @rundaily
def update_weekly(): def update_weekly():
global weekly_topartists, weekly_toptracks global weekly_topartists, weekly_toptracks

View File

@ -18,12 +18,6 @@ entitycache = lru.LRU(HIGH_NUMBER)
hits, misses = 0, 0 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 @runhourly
def maintenance(): def maintenance():
@ -118,7 +112,7 @@ def trim_cache():
ramprct = psutil.virtual_memory().percent ramprct = psutil.virtual_memory().percent
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 = (ramprct/100) ** 3 ratio = 0.6
targetsize = max(int(len(cache) * ratio),100) targetsize = max(int(len(cache) * ratio),100)
cache.set_size(targetsize) cache.set_size(targetsize)
cache.set_size(HIGH_NUMBER) cache.set_size(HIGH_NUMBER)

View File

@ -300,9 +300,6 @@ with open(pthj(dir_settings['state'],".lastmalojaversion"),"w") as filed:
from doreah import config from doreah import config
config( config(
caching={
"folder": data_dir['cache']()
},
auth={ auth={
"multiuser":False, "multiuser":False,
"cookieprefix":"maloja", "cookieprefix":"maloja",
@ -313,7 +310,6 @@ config(
"logfolder": data_dir['logs']() if malojaconfig["LOGGING"] else None "logfolder": data_dir['logs']() if malojaconfig["LOGGING"] else None
}, },
regular={ regular={
"autostart": False,
"offset": malojaconfig["TIMEZONE"] "offset": malojaconfig["TIMEZONE"]
} }
) )

View File

@ -35,7 +35,7 @@ from .proccontrol.profiler import profile
PORT = malojaconfig["PORT"] PORT = malojaconfig["PORT"]
HOST = malojaconfig["HOST"] HOST = malojaconfig["HOST"]
THREADS = 8 THREADS = 12
BaseRequest.MEMFILE_MAX = 15 * 1024 * 1024 BaseRequest.MEMFILE_MAX = 15 * 1024 * 1024
#STATICFOLDER = importlib.resources.path(__name__,"web/static") #STATICFOLDER = importlib.resources.path(__name__,"web/static")