Closed ArtemkaKun closed 1 year ago
Since the star counts are in the database, can’t they be fetched by a separate script that updates the database on a webhook/every day? No time is added at start up of vpm but it’s actually reduced and the logic is seperated.
Imo star fetching isn’t part of the vpm app but should be separate logic.
When a user submits a new package the fetch script can be called and the database is updated.
@Casper64
I see 2 problems with your proposition:
Ok, seems there is no webhook from GitHub that will rise an event when a particular repository was starred. We should manually check star changes :/
And rate limit will come into play then https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting
I went on google to look how other package managers do it (npm pub.dev cargo etc.). None of them have github star count, but their own "like" counter. Wouldn't that be a better solution? Solves a lot of headaches
It should be easier I think. On the other hand, I think people will be more active on GitHub, then on VPM. @medvednikov how stars feature should work?
I think stars should be in VPM because there are two problems:
It would be nice to use hosting platforms only for hosting Git repositories and nothing more. All other features should be implemented within VPM.
Indeed, github is not going to be the only site we support. So we should just have our own stars.
Ok, I improved issue description and will close this PR since changes here have no sense anymore
Fixes #47
This PR implements 2 things for now:
Problem
The problem is not trivial, however.
Currently, 3 problems with starts need to be addressed:
Solution
One way to resolve the issue - on start, VPM can iterate over all packages currently in DB and do 2 things:
This will add some time to the VPM start time (probably if we split requests on different processes it will go faster).
Also, when the user adds a new package to VPM, it needs to subscribe on event/webhook for the stars count update for this repo as well.
In this way, we will have a good user experience, up-to-date starts count data (without migration for old packages required), and will no exceed the GitHub API rate limit.