Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion app/lib/package/api_export/api_exporter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void registerApiExporter(ApiExporter value) =>
/// The active API Exporter service or null if it hasn't been initialized.
ApiExporter? get apiExporter => ss.lookup(#_apiExporter) as ApiExporter?;

const _concurrency = 30;
const _concurrency = 50;

class ApiExporter {
final ExportedApi _api;
Expand Down Expand Up @@ -134,6 +134,7 @@ class ApiExporter {
Future<void> synchronizeExportedApi() async {
final allPackageNames = <String>{};
final packageQuery = dbService.query<Package>();
var errCount = 0;
await packageQuery.run().parallelForEach(_concurrency, (pkg) async {
final name = pkg.name!;
if (pkg.isNotVisible) {
Expand All @@ -143,6 +144,9 @@ class ApiExporter {

// TODO: Consider retries around all this logic
await synchronizePackage(name);
}, onError: (e, st) {
_log.warning('synchronizePackage() failed', e, st);
errCount++;
});

await synchronizePackageNameCompletionData();
Expand All @@ -157,6 +161,12 @@ class ApiExporter {
});

await _api.garbageCollect(allPackageNames);

if (errCount > 0) {
throw Exception(
'$errCount exceptions happened while calling synchronizeExportedApi',
);
}
}

/// Sync package and into [ExportedApi], this will synchronize package into
Expand Down
2 changes: 1 addition & 1 deletion app/lib/package/api_export/exported_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const _minGarbageAge = Duration(hours: 3);
/// All writes to the bucket containing the exported API should go through this
/// interface.
final class ExportedApi {
final Pool _pool = Pool(50);
final Pool _pool = Pool(80);
final Storage _storage;
final Bucket _bucket;
final List<String> _prefixes = [
Expand Down
Loading