File tree Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ Future<void> main(List<String> args) async {
1919 json.decode (utf8.decode (gzip.decode (await file.readAsBytes ())))
2020 as Map <String , Object ?>;
2121 final snapshot = SearchSnapshot .fromJson (content);
22- snapshot.documents !
23- . removeWhere ((packageName, doc) => isSoftRemoved (packageName));
24- final index = InMemoryPackageIndex (documents : snapshot.documents! .values);
22+ final index = InMemoryPackageIndex (
23+ documents :
24+ snapshot.documents! .values. where ((d) => ! isSoftRemoved (d.package)) );
2525
2626 // NOTE: please add more queries to this list, especially if there is a performance bottleneck.
2727 final queries = [
Original file line number Diff line number Diff line change @@ -78,10 +78,8 @@ Future<shelf.Response> apiPackageNamesHandler(shelf.Request request) async {
7878
7979 final bytes = await cache.packageNamesDataJsonGz ().get (() async {
8080 final packageNames = await nameTracker.getVisiblePackageNames ();
81- packageNames.removeWhere (isSoftRemoved);
82-
8381 return gzip.encode (jsonUtf8Encoder.convert ({
84- 'packages' : packageNames,
82+ 'packages' : packageNames. where ((p) => ! isSoftRemoved (p)). toList () ,
8583 // pagination is off for now
8684 'nextUrl' : null ,
8785 }));
Original file line number Diff line number Diff line change @@ -132,6 +132,9 @@ class SearchBackend {
132132 if (! claim.valid) {
133133 return ;
134134 }
135+ if (isSoftRemoved (package)) {
136+ return ;
137+ }
135138 // Skip if the last document timestamp is before [updated].
136139 // 1-minute window is kept to reduce clock-skew.
137140 if (updated != null ) {
@@ -469,9 +472,6 @@ class SearchBackend {
469472 return null ;
470473 }
471474 final snapshot = SearchSnapshot .fromJson (map);
472- snapshot.documents!
473- .removeWhere ((packageName, doc) => isSoftRemoved (packageName));
474-
475475 final count = snapshot.documents! .length;
476476 _logger.info ('Got $count packages from snapshot at ${snapshot .updated }' );
477477 return snapshot.documents? .values.toList ();
You can’t perform that action at this time.
0 commit comments