BCcampus / open-sage

Theme for open.bccampus.ca
MIT License
1 stars 0 forks source link

Have stats on open site cached for 24 hours #213

Open josieg opened 4 years ago

josieg commented 4 years ago

Is your feature request related to a problem? Please describe. The stats pages on the OpenEd website are slow to load because they are updated whenever the site is accessed.

Describe the solution you'd like I would like the stats on the open site to cache and be refreshed once every 24 hours.

josieg commented 4 years ago

Lauri has asked that I label this issue "urgent" because:

"I was reminded of the inaccessible nature of this page during a discussion I had with Tannis on Friday when I showed her the new section of the Adoption Guide that refers to this page, and Tannis couldn't get to that page."

alex-418 commented 4 years ago

Currently working on moving the stats configuration to a new server, this should help alleviate some of these concerns.

Caching Functionality in current application: The application itself currently tries to cache the stats data with an 8 hour refresh interval, but as you have noted, this is not working as expected, and is not very efficient. The reason for the slow load is because it requires someone to visit the page to make the very large API request to matomo, parses that request (so we can do some logic with it), and then generate the cache files for local storage... only after all of this is completed, the page loads for users.

Solution: The solution requires refactoring or replacing the caching functionality along with the associated application logic (a big task because it has dependencies). Would like to scope out exactly what the requirements are around stats on the open site, and craft a solution that requests and caches only that specific data we need from the Matomo API. This should improve the performance of this page.

New front-end: I should also note we're likely going to be working on a replacement front-end for this application, as part of an effort to use a modern technology stack and a development methodology to avoid these types of issues in the future.