-
Notifications
You must be signed in to change notification settings - Fork 241
Parallelize security advisories and package status fetching #4824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
391a942
4f63678
5932118
927d22c
d51ddc0
2084a14
1c6d4ca
939286f
1d09260
3d7847d
4efbced
375cfee
cfa7637
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -170,6 +170,30 @@ Consider setting the `PUB_CACHE` variable manually. | |
| return pubspec; | ||
| } | ||
|
|
||
| /// Prefetches the status and advisories for [packages] in parallel. | ||
| Future<void> prefetchAdvisoriesAndStatus(Iterable<PackageId> packages) async { | ||
| final futures = <Future<Object?>>[]; | ||
| for (final id in packages) { | ||
| futures.add( | ||
| id.source.status( | ||
| id.toRef(), | ||
| id.version, | ||
| this, | ||
| maxAge: const Duration(days: 3), | ||
| ), | ||
| ); | ||
| final advisoriesFuture = id.source.getAdvisoriesForPackageVersion( | ||
| id, | ||
| this, | ||
| const Duration(days: 3), | ||
| ); | ||
| if (advisoriesFuture != null) { | ||
| futures.add(advisoriesFuture); | ||
| } | ||
| } | ||
| await Future.wait(futures); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have concurrency limits here? probably that exists in fetch and schedule logic, just wanted to check.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Really good point. Shared the pool with the ratelimitedscheduler |
||
| } | ||
|
|
||
| /// Get the IDs of all versions that match [ref]. | ||
| /// | ||
| /// Note that this does *not* require the packages to be downloaded locally, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we were missing the maxAge