Skip to content

Commit

Permalink
Purge stale cache before analysis. (dart-lang#7269)
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos authored Dec 8, 2023
1 parent 5d220e8 commit 179e069
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions app/lib/task/scheduler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:_pub_shared/data/task_payload.dart';
import 'package:clock/clock.dart';
import 'package:logging/logging.dart' show Logger;
import 'package:meta/meta.dart';
import 'package:pub_dev/package/backend.dart';
import 'package:pub_dev/shared/configuration.dart';
import 'package:pub_dev/shared/datastore.dart';
import 'package:pub_dev/shared/utils.dart';
Expand Down Expand Up @@ -170,6 +171,11 @@ Future<void> schedule(
scheduleMicrotask(() async {
var rollbackPackageState = true;
try {
// Purging cache is important for the edge case, where the new upload happens
// on a different runtime version, and the current one's cache is still stale
// and does not have the version yet.
// TODO(https://github.com/dart-lang/pub-dev/issues/7268) remove after it gets fixed.
await purgePackageCache(payload.package);
_log.info(
'creating instance $instanceName in $zone for '
'package:${state.package}',
Expand Down
4 changes: 2 additions & 2 deletions pkg/pub_worker/lib/src/bin/pana_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ Future<void> main(List<String> args) async {
});

// Fetch the pubspec so we detect which SDK to use for analysis
// TODO: Download the package, extract and load the pubspec.yaml, that way
// we won't have to list versions again later.
// TODO(https://github.com/dart-lang/pub-dev/issues/7268): Download the archive,
// extract and load the pubspec.yaml, that way we won't have to list versions.
final pubspec = await fetchPubspec(
package: package,
version: version,
Expand Down

0 comments on commit 179e069

Please sign in to comment.