pub-dev icon indicating copy to clipboard operation
pub-dev copied to clipboard

Consider adding a real-time package updates endpoint instead of the cached `/api/packages`

Open AlexV525 opened this issue 1 year ago • 5 comments

I uploaded candid_dart_core at 10:37 PM, but the package shows up at 10:58 PM in the endpoint. The endpoint is the source where we determine which packages need an update in our flutter-io.cn CDN.

AlexV525 avatar Dec 20 '24 15:12 AlexV525

@AlexV525: /api/packages is a cached endpoint (10 minutes), but it is also using our name-tracker component that periodically checks the package entries (every 15 minutes). Your reported lag seems to be a combination of those two. (Moreover it is an unofficial endpoint we may want to stop supporting in the future, as it combines more aspects into one endpoint, making it hard to cache/invalidate).

I think in the past few months we have discussed a new endpoint that only returns the package names that got a new version published or some metadata updated in the past hour/day/week. Would that be enough for your use case?

isoos avatar Jan 03 '25 10:01 isoos

I think in the past few months we have discussed a new endpoint that only returns the package names that got a new version published or some metadata updated in the past hour/day/week. Would that be enough for your use case?

That sounds covered our cases. AFAIK we use the name of the packages and handle the rest instead of depending on the provided information. FYI @chenglu

AlexV525 avatar Jan 03 '25 10:01 AlexV525

May I know more about the name-tracker component/api? We need to update the package updates / CDN purge code accordingly.

chenglu avatar Jan 03 '25 12:01 chenglu

May I know more about the name-tracker component/api?

This is an internal component, not really exposed, but used in other parts of the app. I wouldn't build on the current functionality of it.

We need to update the package updates / CDN purge code accordingly.

I think a new API endpoint is the way to go here.

isoos avatar Jan 03 '25 12:01 isoos

I LOVE this idea if the team can public this as an API endpoint, so that we could do the cache to the CN mirrors smartly!

chenglu avatar Jan 03 '25 13:01 chenglu