wikimedia / WikiContrib

A tool for Wikimedia community members to visualize their technical contributions
https://wikicontrib.toolforge.org
MIT License
23 stars 32 forks source link

added query result caching feature #215

Closed NdibeRaymond closed 4 years ago

NdibeRaymond commented 4 years ago

Prior to this PR, wikicontrib backend doesn't have a way of caching query results and as a result, we end up making unnecessary results every time we create a query or refresh the page. Issue addressed: #214

How The Caching Feature Works When you request for the contributions of a wikimedian, the app first checks if we have any list of contributions associated to the user and if so, returns that or makes a request to the APIs if we have not cached contributions of that user. To limit stale data, the app deletes all contributions older than 1 day. As it was necessary to have a consistent query hash for this feature to work, i also had to switch from using random strings as hash to generating a unique hash using the submitted user details

srish commented 4 years ago

@NdibeRaymond While testing another PR, I've a related question-how often do we delete queries on the backend https://contraband.toolforge.org/admin/?

NdibeRaymond commented 4 years ago

@NdibeRaymond While testing another PR, I've a related question-how often do we delete queries on the backend https://contraband.toolforge.org/admin/?

Right now queries are not being deleted because the cron job is failing. When this PR is merged, queries will no longer be deleted at all. This is because this PR added the unique URL feature and the user query needs to be in the database for that to work. But the good thing is that we can no longer have duplicate queries. That is, every query about a user will automatically map to the one on the database (if we have queried for that users contributions in the past), as a result, it is perfectly ok if we are not deleting queries anymore. But we can also decide to do that once in a year on something similar

rammanoj commented 4 years ago

I just added one comment. Remaining everything is good to go :) Please resolve the comment and merge the change :)