Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

perf: caching on statistics endpoint #949

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Erb3
Copy link

@Erb3 Erb3 commented Aug 12, 2024

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

@Erb3 Erb3 changed the title Add caching statistics Add caching to statistics endpoint Aug 12, 2024
@IMB11
Copy link

IMB11 commented Aug 13, 2024

This would be great for #1301 on the monorepo.

@Erb3
Copy link
Author

Erb3 commented Aug 13, 2024

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?

@IMB11
Copy link

IMB11 commented Aug 13, 2024

Are the statistics not used by analytics endpoints?

@IMB11
Copy link

IMB11 commented Aug 13, 2024

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

@Erb3 Erb3 changed the title Add caching to statistics endpoint perf: caching on statistics endpoint Aug 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add caching to /statistics endpoint
2 participants