krz/skunky-art

Alternative privacy frontend for DeviantArt.

clone: git clone https://gitbay.org/krz/skunky-art.git

40d405f318a109aad5e7de7ad71fedcc04bb0e86

verified · cmc

author: Christian Cleberg <hello@cleberg.net> · 2026-07-15T07:23:59Z

fix(cache): correct max-size megabyte conversion

max-size is documented in SETUP.md as megabytes, but the conversion was
`*= 1024 ^ 2`. In Go `^` is XOR, not exponentiation, so this multiplied
by 1026 rather than 1048576 -- a configured max-size of 200 produced a
~205 KB cap instead of 200 MB, wiping the cache almost immediately.

This changes runtime behaviour: the cache will now grow to the size the
config actually asks for.
 app/config.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/config.go b/app/config.go
index 2d32d19..acd9b71 100755
--- a/app/config.go
+++ b/app/config.go
@@ -88,7 +88,9 @@ func ExecuteConfig() {
 
 				lifetimeParsed = duration * int64(num)
 			}
-			CFG.Cache.MaxSize *= 1024 ^ 2
+			// max-size is documented in megabytes. This was 1024^2, which in Go is
+			// XOR (1026), not exponentiation — so the cap was ~1000x too small.
+			CFG.Cache.MaxSize *= 1024 * 1024
 			go InitCacheSystem()
 		}