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
# 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

View File

@ -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)

View File

@ -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"]
}
)

View File

@ -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")