Strypper / mauisland

MAUIsland 🏝️ is the number 1 controls gallery for .NET MAUI
MIT License
194 stars 14 forks source link

Features/sync repo new #171

Closed hatan09 closed 8 months ago

hatan09 commented 8 months ago

COOL NEW FEATURE!!!!

Contributors

Describe your changes

As MAUIsland needs information of GitHub repositories for the "Community Gallery", it usually makes calls to GitHub using Octokit, but sometimes it reaches the limit, and GitHub blocks the app from syncing repos. To resolve this issue, I've added a local storage mechanism (using SQLite) which is consumed by sync services. This kind of services syncs repositories from GitHub using Octokit and stores in those localdbs so that following calls within 1 hour can query repo info from localdbs instead of syncing them from GitHub. If the time interval of 1 hour since the last call to GitHub API (syncing) has passed, the sync service will make some calls to GitHub API to get and update repositories. This feature not only solves the syncing issue but also improves syncing process.

Have we discussed about this before? (Please link the discussion link below)

Yes!

Notes

The current implementation has some drawbacks. One of them is that all of views which rely on GitHub repositories info and use GitHub repo sync services make call to these services simultaneously, and all repo sync share the same record (last item in a table - CardInfoSyncLocalDb) which holds last update time. There could be a case where one call has finished fetching and updating (so fast) for one repo, then the next calls will get the status that repo is up to date despite that repo has not been refreshed after 1 hour (because the previous call finished too fast, this call could only get the data already updated by the previous one - yes they rely on a single record holding updating time). Furthermore, for the very first time this app is run, there is no data within the localdbs, so if the case happens, 1 for a few repos will have null value, and exceptions will be thrown.