Skip to content

Conversation

@szakarias
Copy link
Contributor

No description provided.

Comment on lines 14 to 28
Future<void> compute30DaysTotalTask() async {
final allDownloadCounts = await downloadCountsBackend.listAllDownloadCounts();
final totals = await compute30DayTotals(allDownloadCounts);
await updload30DaysTotal(totals);
}

Future<Map<String, int>> compute30DayTotals(
Stream<DownloadCounts> downloadCounts) async {
final res = <String, int>{};
await for (final dc in downloadCounts) {
res[dc.package] = compute30DayTotal(dc);
}

return res;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not merge these with listAllDownloadCounts, and make a single method?

Passing around streams is a bit scary, even if I think our stream will retry individual pages as it fetches the entire result.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think logically this is the separation that makes sense....

@szakarias szakarias merged commit 6449aa3 into dart-lang:master Oct 1, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants