Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexios80 committed Jan 23, 2025
1 parent 07a607c commit 6dfd5d3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pub_stats_collector/lib/repo/pub_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ class PubRepo {
final dependentMap = <String, Set<String>>{};
var fetched = 0;

// Prevent too many concurrent calls to the pub API
final pubQueue = TaskQueue(maxJobs: 100);
Future<void> fetchPackageData(String package) async {
final result = await Future.wait([
_client.packageScore(package),
_client.packagePublisher(package),
_client.packageOptions(package),
_client.packageInfo(package),
pubQueue.add(() => _client.packageScore(package)),
pubQueue.add(() => _client.packagePublisher(package)),
pubQueue.add(() => _client.packageOptions(package)),
pubQueue.add(() => _client.packageInfo(package)),
]);

final score = result[0] as PackageScore;
Expand Down

0 comments on commit 6dfd5d3

Please sign in to comment.