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
6 changes: 3 additions & 3 deletions app/bin/tools/search_benchmark.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Future<void> main(List<String> args) async {
json.decode(utf8.decode(gzip.decode(await file.readAsBytes())))
as Map<String, Object?>;
final snapshot = SearchSnapshot.fromJson(content);
snapshot.documents!
.removeWhere((packageName, doc) => isSoftRemoved(packageName));
final index = InMemoryPackageIndex(documents: snapshot.documents!.values);
final index = InMemoryPackageIndex(
documents:
snapshot.documents!.values.where((d) => !isSoftRemoved(d.package)));

// NOTE: please add more queries to this list, especially if there is a performance bottleneck.
final queries = [
Expand Down
2 changes: 0 additions & 2 deletions app/lib/frontend/handlers/custom_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ Future<shelf.Response> apiPackageNamesHandler(shelf.Request request) async {

final bytes = await cache.packageNamesDataJsonGz().get(() async {
final packageNames = await nameTracker.getVisiblePackageNames();
packageNames.removeWhere(isSoftRemoved);

return gzip.encode(jsonUtf8Encoder.convert({
'packages': packageNames,
// pagination is off for now
Expand Down
5 changes: 3 additions & 2 deletions app/lib/package/name_tracker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:clock/clock.dart';
import 'package:gcloud/service_scope.dart' as ss;
import 'package:logging/logging.dart';
import 'package:meta/meta.dart';
import 'package:pub_dev/package/overrides.dart';
import 'package:pub_package_reader/pub_package_reader.dart';

import '../shared/datastore.dart';
Expand Down Expand Up @@ -51,7 +52,7 @@ class TrackedPackage {
updated: p.updated!,
latestVersion: p.latestVersion!,
lastPublished: p.lastVersionPublished!,
isVisible: p.isVisible,
isVisible: p.isVisible && !isSoftRemoved(p.name!),
);

@visibleForTesting
Expand Down Expand Up @@ -125,7 +126,7 @@ class NameTracker {

/// Get the names of all visible packages.
///
/// Packages that are _withdrawn_ are not listed here.
/// Packages that are _moderated_ or _soft removed_ are NOT listed here.
/// Packages that are _unlisted_ or _discontinued_ are **included in this list**.
///
/// If it is called before the first scan was done, it will wait for
Expand Down
6 changes: 3 additions & 3 deletions app/lib/search/backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ class SearchBackend {
if (!claim.valid) {
return;
}
if (isSoftRemoved(package)) {
return;
}
// Skip if the last document timestamp is before [updated].
// 1-minute window is kept to reduce clock-skew.
if (updated != null) {
Expand Down Expand Up @@ -469,9 +472,6 @@ class SearchBackend {
return null;
}
final snapshot = SearchSnapshot.fromJson(map);
snapshot.documents!
.removeWhere((packageName, doc) => isSoftRemoved(packageName));

final count = snapshot.documents!.length;
_logger.info('Got $count packages from snapshot at ${snapshot.updated}');
return snapshot.documents?.values.toList();
Expand Down
Loading