labrinth icon indicating copy to clipboard operation
labrinth copied to clipboard

perf: caching on statistics endpoint

Open piprett opened this issue 1 year ago • 4 comments

I'll start by saying that the code here is probably not ideal, it is a lot of duplicate. I am unsure how to deduplicate it, as the SQL querries are different, and async. With that said, it appears to work well based on my testing. It caches the statistics for 30 minutes at a time, which heavily improves the response times of this endpoint.

Closes modrinth/code#2544

piprett avatar Aug 12 '24 11:08 piprett

This would be great for #1301 on the monorepo.

IMB11 avatar Aug 13 '24 08:08 IMB11

This would be great for #1301 on the monorepo.

Correct me if I am wrong, but modrinth/code#1301 seems to be focusing on analytics, not the global statistics?

piprett avatar Aug 13 '24 09:08 piprett

Are the statistics not used by analytics endpoints?

IMB11 avatar Aug 13 '24 09:08 IMB11

Oh I misunderstood, this is just the general labrinth instance statistics.

IMB11 avatar Aug 13 '24 09:08 IMB11