From 2d2a7c2ee7450f26e222efa625eadc74a2b0bee0 Mon Sep 17 00:00:00 2001 From: krateng Date: Sun, 10 Apr 2022 18:44:55 +0200 Subject: [PATCH 1/7] Updated Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c7b9cd..ae4c17c 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ To backup your data, run `maloja backup`, optional with `--include_images`. ## 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 From 5a2856a6823b8ce9c3acdf7c720ca7934521bc52 Mon Sep 17 00:00:00 2001 From: krateng Date: Sun, 10 Apr 2022 23:26:03 +0200 Subject: [PATCH 2/7] Added log output to cache trimming --- maloja/__pkginfo__.py | 2 +- maloja/database/dbcache.py | 6 ++++-- pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py index b8da361..3c9f262 100644 --- a/maloja/__pkginfo__.py +++ b/maloja/__pkginfo__.py @@ -4,7 +4,7 @@ # you know what f*ck it # this is hardcoded for now because of that damn project / package name discrepancy # i'll fix it one day -VERSION = "3.0.0-beta.4" +VERSION = "3.0.0-beta.5" HOMEPAGE = "https://github.com/krateng/maloja" diff --git a/maloja/database/dbcache.py b/maloja/database/dbcache.py index ed93eb2..5654ef8 100644 --- a/maloja/database/dbcache.py +++ b/maloja/database/dbcache.py @@ -113,10 +113,12 @@ def trim_cache(): if ramprct > malojaconfig["DB_MAX_MEMORY"]: log(f"{ramprct}% RAM usage, reducing caches!") 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(HIGH_NUMBER) - log(f"New RAM usage: {psutil.virtual_memory().percent}%") + #log(f"New RAM usage: {psutil.virtual_memory().percent}%") + print_stats() diff --git a/pyproject.toml b/pyproject.toml index c3d1c74..32cf53d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "malojaserver" -version = "3.0.0-beta.4" +version = "3.0.0-beta.5" description = "Self-hosted music scrobble database" readme = "./README.md" requires-python = ">=3.6" From cc4d40ae3ff88d5dc3a85feb912b248a91004059 Mon Sep 17 00:00:00 2001 From: krateng Date: Mon, 11 Apr 2022 21:22:58 +0200 Subject: [PATCH 3/7] Reenabled Dockerhub Readme update --- .github/workflows/dockerhub.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml index 16a4197..f20b655 100644 --- a/.github/workflows/dockerhub.yml +++ b/.github/workflows/dockerhub.yml @@ -41,11 +41,11 @@ jobs: tags: ${{ steps.meta.outputs.tags }} 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 -# uses: peter-evans/dockerhub-description@616d1b63e806b630b975af3b4fe3304307b20f40 -# with: -# username: ${{ secrets.DOCKERHUB_USERNAME }} -# password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} -# repository: krateng/maloja -# short-description: ${{ github.event.repository.description }} + - name: Update Readme and short description + uses: peter-evans/dockerhub-description@1cf9afbac3c5d2fdc66416a464c2c38260cb6f8d + continue-on-error: true + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} + repository: krateng/maloja + short-description: ${{ github.event.repository.description }} From b8aa2a562ec3f64c62057a8dabebf23c76e79901 Mon Sep 17 00:00:00 2001 From: krateng Date: Tue, 12 Apr 2022 05:31:31 +0200 Subject: [PATCH 4/7] Bumped doreah requirement --- pyproject.toml | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 32cf53d..461c9cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ classifiers = [ dependencies = [ "bottle>=0.12.16", "waitress>=1.3", - "doreah>=1.8.1, <2", + "doreah>=1.9.0, <2", "nimrodel>=0.8.0", "setproctitle>=1.1.10", #"pyvips>=2.1.16", diff --git a/requirements.txt b/requirements.txt index 1d97c23..60aceb1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ bottle>=0.12.16 waitress>=1.3 -doreah>=1.8.1, <2 +doreah>=1.9.0, <2 nimrodel>=0.8.0 setproctitle>=1.1.10 jinja2>=2.11 From cabfa298b946c0970efd0976c0c8f9802b3bc654 Mon Sep 17 00:00:00 2001 From: krateng Date: Tue, 12 Apr 2022 05:33:03 +0200 Subject: [PATCH 5/7] Replaced cache trimming with full clear for now --- maloja/__pkginfo__.py | 2 +- maloja/database/dbcache.py | 7 ++++--- pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py index 3c9f262..d7ba9e6 100644 --- a/maloja/__pkginfo__.py +++ b/maloja/__pkginfo__.py @@ -4,7 +4,7 @@ # you know what f*ck it # this is hardcoded for now because of that damn project / package name discrepancy # i'll fix it one day -VERSION = "3.0.0-beta.5" +VERSION = "3.0.0-beta.6" HOMEPAGE = "https://github.com/krateng/maloja" diff --git a/maloja/database/dbcache.py b/maloja/database/dbcache.py index 5654ef8..941456a 100644 --- a/maloja/database/dbcache.py +++ b/maloja/database/dbcache.py @@ -114,9 +114,10 @@ def trim_cache(): log(f"{ramprct}% RAM usage, reducing caches!") ratio = 0.6 targetsize = max(int(len(cache) * ratio),50) - log(f"Reducing to {targetsize} entries") - cache.set_size(targetsize) - cache.set_size(HIGH_NUMBER) + #log(f"Reducing to {targetsize} entries") + #cache.set_size(targetsize) + #cache.set_size(HIGH_NUMBER) + cache.clear() #log(f"New RAM usage: {psutil.virtual_memory().percent}%") print_stats() diff --git a/pyproject.toml b/pyproject.toml index 461c9cf..a7ad1a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "malojaserver" -version = "3.0.0-beta.5" +version = "3.0.0-beta.6" description = "Self-hosted music scrobble database" readme = "./README.md" requires-python = ">=3.6" From 189dfb58bcd4bf4870abfa8b7a080df44e5f1c3f Mon Sep 17 00:00:00 2001 From: krateng Date: Tue, 12 Apr 2022 16:02:30 +0200 Subject: [PATCH 6/7] Limited cache size --- maloja/database/dbcache.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/maloja/database/dbcache.py b/maloja/database/dbcache.py index 941456a..b3d4ce3 100644 --- a/maloja/database/dbcache.py +++ b/maloja/database/dbcache.py @@ -11,9 +11,12 @@ from doreah.logging import log from ..globalconf import malojaconfig HIGH_NUMBER = 1000000 +CACHE_SIZE = 10000 +ENTITY_CACHE_SIZE = 1000000 +CACHE_ADJUST_STEP = 100 -cache = lru.LRU(HIGH_NUMBER) -entitycache = lru.LRU(HIGH_NUMBER) +cache = lru.LRU(CACHE_SIZE) +entitycache = lru.LRU(ENTITY_CACHE_SIZE) hits, misses = 0, 0 @@ -111,13 +114,16 @@ def invalidate_entity_cache(): def trim_cache(): ramprct = psutil.virtual_memory().percent if ramprct > malojaconfig["DB_MAX_MEMORY"]: - log(f"{ramprct}% RAM usage, reducing caches!") - ratio = 0.6 - targetsize = max(int(len(cache) * ratio),50) + log(f"{ramprct}% RAM usage, clearing cache and adjusting size!") + #ratio = 0.6 + #targetsize = max(int(len(cache) * ratio),50) #log(f"Reducing to {targetsize} entries") #cache.set_size(targetsize) #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() From f31c95228eb2dc01e661be928ffd881c063377da Mon Sep 17 00:00:00 2001 From: krateng Date: Tue, 12 Apr 2022 16:03:47 +0200 Subject: [PATCH 7/7] Ride now, ride now! Ride to Gondor! --- maloja/__pkginfo__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py index d7ba9e6..f772f7e 100644 --- a/maloja/__pkginfo__.py +++ b/maloja/__pkginfo__.py @@ -4,7 +4,7 @@ # you know what f*ck it # this is hardcoded for now because of that damn project / package name discrepancy # i'll fix it one day -VERSION = "3.0.0-beta.6" +VERSION = "3.0.0" HOMEPAGE = "https://github.com/krateng/maloja" diff --git a/pyproject.toml b/pyproject.toml index a7ad1a6..d9f2fb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "malojaserver" -version = "3.0.0-beta.6" +version = "3.0.0" description = "Self-hosted music scrobble database" readme = "./README.md" requires-python = ">=3.6"