Commit Graph

7 Commits

Author SHA1 Message Date
Taras Kushnir 07b5c24e96 Add ability to set TTL when loading through cache 2025-11-24 08:15:25 +02:00
Taras Kushnir 16e4244077 Add functionality to backfill potential stale session in portal
Also get rid of unnecessary changes from previous commit
2025-11-16 21:09:16 +02:00
Taras Kushnir 1dc330150c Reread cached properties from time to time
There was a problem where, after upgrading otter to v2, there was a chance
of properties being just cached and not reread. The reason we couldn't use
otter's magic reloading is that there's more business logic that needs to
be executed than just to reread value from DB.

One drawback is in order to keep otter's package "hidden", a clone of Loader
had to be created in common.

Additionally Verify API of server was refactored so we return a clear error
externally in case of auth failure (related to "delayed" API key check)
2025-06-21 14:16:28 +03:00
Taras Kushnir bf0598c1a9 Make siteverify API more resilient for unauthorized access
- more aggressive caching of API keys and added cache warmup
- remove direct DB access in APIkey() middleware immediately
- decrease resources usage for test puzzles
- decrease cache collision possibility for cached solved puzzles
- cosmetic improvement in rate limiter and leaky bucket Updater logic
- move user limits check and API key backfill to a separate goroutine
2025-06-21 14:16:28 +03:00
Taras Kushnir 9ec1ef8d65 Refactor caching layer
Main reason being otter/v2 release with APIs for sliding expiration.

- added new cache API to use Loader logic from otter/v2 (fetch from DB)
- main direction of work is improving "negative caching" performance
  (currently it is still intertwined with the main cache)
- expose new Prometheus metric for cache hit ratio
2025-06-21 14:16:28 +03:00
Taras Kushnir 0a469c7f9e Update otter to v2 2025-06-17 20:35:18 +03:00
Taras Kushnir 4951055189 Initial commit 2025-05-31 10:56:00 +03:00