File tree Expand file tree Collapse file tree 4 files changed +9
-10
lines changed Expand file tree Collapse file tree 4 files changed +9
-10
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,8 +78,6 @@ 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 ({
8482 'packages' : packageNames,
8583 // pagination is off for now
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import 'package:clock/clock.dart';
88import 'package:gcloud/service_scope.dart' as ss;
99import 'package:logging/logging.dart' ;
1010import 'package:meta/meta.dart' ;
11+ import 'package:pub_dev/package/overrides.dart' ;
1112import 'package:pub_package_reader/pub_package_reader.dart' ;
1213
1314import '../shared/datastore.dart' ;
@@ -51,7 +52,7 @@ class TrackedPackage {
5152 updated: p.updated! ,
5253 latestVersion: p.latestVersion! ,
5354 lastPublished: p.lastVersionPublished! ,
54- isVisible: p.isVisible,
55+ isVisible: p.isVisible && ! isSoftRemoved (p.name ! ) ,
5556 );
5657
5758 @visibleForTesting
@@ -125,7 +126,7 @@ class NameTracker {
125126
126127 /// Get the names of all visible packages.
127128 ///
128- /// Packages that are _withdrawn_ are not listed here.
129+ /// Packages that are _moderated_ or _soft removed_ are NOT listed here.
129130 /// Packages that are _unlisted_ or _discontinued_ are **included in this list**.
130131 ///
131132 /// If it is called before the first scan was done, it will wait for
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