Skip to content

Commit

Permalink
Delete all ScoreCard entities on GC - regardless of runtimeVersion or…
Browse files Browse the repository at this point in the history
… updated. (#6960)
  • Loading branch information
isoos authored Aug 24, 2023
1 parent bdbcf74 commit 736e246
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Important changes to data models, configuration, and migrations between each
AppEngine version, listed here to ease deployment and troubleshooting.

## Next Release (replace with git tag when deployed)
* Note: `Job` and `ScoreCard` entities will be deleted in Datastore.

## `20230822t112400-all`

Expand Down
8 changes: 1 addition & 7 deletions app/lib/scorecard/backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import 'models.dart';

final _logger = Logger('pub.scorecard.backend');

final Duration _deleteThreshold = const Duration(days: 182);

/// Sets the active scorecard backend.
void registerScoreCardBackend(ScoreCardBackend backend) =>
ss.register(#_scorecard_backend, backend);
Expand Down Expand Up @@ -155,11 +153,7 @@ class ScoreCardBackend {

/// Deletes the old entries that predate [versions.gcBeforeRuntimeVersion].
Future<void> deleteOldEntries() async {
final now = clock.now();
await _db.deleteWithQuery(_db.query<ScoreCard>()
..filter('runtimeVersion <', versions.gcBeforeRuntimeVersion));
await _db.deleteWithQuery(_db.query<ScoreCard>()
..filter('updated <', now.subtract(_deleteThreshold)));
await _db.deleteWithQuery(_db.query<ScoreCard>());
}

/// Returns the status of a package and version.
Expand Down

0 comments on commit 736e246

Please sign in to comment.