unmojang / drasl

Yggdrasil-compatible API server for Minecraft
GNU General Public License v3.0
98 stars 14 forks source link

Cache not working? #95

Open Bucky420 opened 1 month ago

Bucky420 commented 1 month ago

not shure if im doing it wrong but the settings should be set right 60 seconds?

i get this in console

Couldn't verify username because servers are unavailable every thing else works fine just would be nice to allow people to login even if auth servers are down for a few hours

evan-goode commented 1 month ago

Currently the cache just acts as a "cushion" so if Drasl wants to make many requests within a short period for the same resource on a FallbackAPIServer, it will re-used the cached response from the fallback server instead of spamming it. After CacheTTLSec seconds elapse after something enters the cache, it gets evicted.

So it sounds like it might be working as intended, but you're right, it would be nice if the cache could also be used if the remote resource is temporarily inaccessible. To do so we'd need to handle each item's TTL ourselves and use https://github.com/dgraph-io/ristretto/blob/v0.1.1/cache.go#L248 instead of SetWithTTL. Then only replace the value in cache if the HTTP request succeeded.

Bucky420 commented 1 month ago

yes i did look around on how you cache stuff its an api .... i used to just save there ip and call it good ..... but perhaps a simple http cache of some sort in front of all this might be ok performance and resources are of no concern to me ATM nor is complex security....for now ..... i am atm only using this internally on lan for my self so. but tbh rilly all i do is log out and login with a drasl user with the same uuid and this rilly solves my issues for now lol . if it work it works