Merge branch 'master' into feature-restructure

This commit is contained in:
krateng 2022-04-12 16:20:53 +02:00
commit d018a758c0
6 changed files with 30 additions and 21 deletions

View File

@ -41,11 +41,11 @@ jobs:
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
# skipping this until https://github.com/peter-evans/dockerhub-description/issues/10 is fixed - name: Update Readme and short description
# - name: Update Readme and short description uses: peter-evans/dockerhub-description@1cf9afbac3c5d2fdc66416a464c2c38260cb6f8d
# uses: peter-evans/dockerhub-description@616d1b63e806b630b975af3b4fe3304307b20f40 continue-on-error: true
# with: with:
# username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
# repository: krateng/maloja repository: krateng/maloja
# short-description: ${{ github.event.repository.description }} short-description: ${{ github.event.repository.description }}

View File

@ -154,7 +154,7 @@ To backup your data, run `maloja backup`, optional with `--include_images`.
## How to scrobble ## How to scrobble
You can set up any amount of API keys in the file `authenticated_machines.tsv` in the `/etc/maloja/clients` folder. It is recommended to define a different API key for every scrobbler you use. You can set up any amount of API keys in the file `apikeys.yml` in your configuration folder (or via the web interface). It is recommended to define a different API key for every scrobbler you use.
### Native support ### Native support

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"
HOMEPAGE = "https://github.com/krateng/maloja" HOMEPAGE = "https://github.com/krateng/maloja"

View File

@ -11,9 +11,12 @@ from doreah.logging import log
from ..pkg_global.conf import malojaconfig from ..pkg_global.conf import malojaconfig
HIGH_NUMBER = 1000000 HIGH_NUMBER = 1000000
CACHE_SIZE = 10000
ENTITY_CACHE_SIZE = 1000000
CACHE_ADJUST_STEP = 100
cache = lru.LRU(HIGH_NUMBER) cache = lru.LRU(CACHE_SIZE)
entitycache = lru.LRU(HIGH_NUMBER) entitycache = lru.LRU(ENTITY_CACHE_SIZE)
hits, misses = 0, 0 hits, misses = 0, 0
@ -111,12 +114,18 @@ def invalidate_entity_cache():
def trim_cache(): 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, clearing cache and adjusting size!")
ratio = 0.6 #ratio = 0.6
targetsize = max(int(len(cache) * ratio),100) #targetsize = max(int(len(cache) * ratio),50)
cache.set_size(targetsize) #log(f"Reducing to {targetsize} entries")
cache.set_size(HIGH_NUMBER) #cache.set_size(targetsize)
log(f"New RAM usage: {psutil.virtual_memory().percent}%") #cache.set_size(HIGH_NUMBER)
cache.clear()
if cache.get_size() > CACHE_ADJUST_STEP:
cache.set_size(cache.get_size() - CACHE_ADJUST_STEP)
#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"
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"
@ -21,7 +21,7 @@ classifiers = [
dependencies = [ dependencies = [
"bottle>=0.12.16", "bottle>=0.12.16",
"waitress>=1.3", "waitress>=1.3",
"doreah>=1.8.1, <2", "doreah>=1.9.0, <2",
"nimrodel>=0.8.0", "nimrodel>=0.8.0",
"setproctitle>=1.1.10", "setproctitle>=1.1.10",
#"pyvips>=2.1.16", #"pyvips>=2.1.16",

View File

@ -1,6 +1,6 @@
bottle>=0.12.16 bottle>=0.12.16
waitress>=1.3 waitress>=1.3
doreah>=1.8.1, <2 doreah>=1.9.0, <2
nimrodel>=0.8.0 nimrodel>=0.8.0
setproctitle>=1.1.10 setproctitle>=1.1.10
jinja2>=2.11 jinja2>=2.11