Skip to content

Commit 36e2b65

Browse files
authored
Reduce the ttl and scope for assets kind list cache entry + version bump. (dart-lang#9620)
1 parent 3adb62f commit 36e2b65

6 files changed

Lines changed: 16 additions & 10 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Important changes to data models, configuration, and migrations between each
22
AppEngine version, listed here to ease deployment and troubleshooting.
33

44
## Next Release (replace with git tag when deployed)
5+
* Bump runtimeVersion to `2026.09.27`.
56

67
## `20260924t135800-all`
78
* Bump runtimeVersion to `2026.09.22`.

‎app/lib/frontend/handlers/package.dart‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,8 @@ Future<PackagePageData> loadPackagePageData(
512512
]);
513513

514514
final selectedVersion = await selectedVersionFuture;
515-
if (selectedVersion == null) {
515+
final assets = await assetsFuture;
516+
if (selectedVersion == null || assets == null) {
516517
throw NotFoundException.resource(
517518
'package "$packageName" version "$versionName"',
518519
);
@@ -522,7 +523,7 @@ Future<PackagePageData> loadPackagePageData(
522523
package: package,
523524
latestReleases: await latestReleasesFuture,
524525
version: selectedVersion,
525-
assets: await assetsFuture,
526+
assets: assets,
526527
asset: await assetFuture,
527528
scoreCard: await scoreCardFuture,
528529
isAdmin: await isAdminFuture,

‎app/lib/package/backend.dart‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,16 +320,15 @@ class PackageBackend {
320320

321321
/// Returns the list of `AssetKind` values that exist for [package] [version].
322322
///
323-
/// Returns an empty list if the [version] is not a semantic version or if
324-
/// the info entity does not exist in the datastore.
325-
Future<List<String>> getAssets(String package, String version) async {
323+
/// Returns an empty list if the info entity does not exist in the datastore.
324+
Future<List<String>?> getAssets(String package, String version) async {
326325
final assets = await cache
327326
.packageVersionAssetKinds(package, version)
328327
.obtain(() async {
329328
final info = await lookupPackageVersionInfo(package, version);
330-
return info?.assets ?? <String>[];
329+
return info?.assets;
331330
});
332-
return assets ?? <String>[];
331+
return assets;
333332
}
334333

335334
/// Looks up a specific package version's asset object.

‎app/lib/shared/redis_cache.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class CachePatterns {
162162
String version,
163163
) => _cache
164164
.withPrefix('package-version-asset-kinds/')
165-
.withTTL(Duration(hours: 12))
165+
.withTTL(Duration(minutes: 10))
166166
.withCodec(utf8)
167167
.withCodec(json)
168168
.withCodec(

‎app/lib/shared/versions.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ final RegExp runtimeVersionPattern = RegExp(r'^\d{4}\.\d{2}\.\d{2}$');
2424
/// when the version switch happens.
2525
const _acceptedRuntimeVersions = <String>[
2626
// The current [runtimeVersion].
27-
'2026.09.22',
27+
'2026.09.27',
2828
// Fallback runtime versions.
29+
'2026.09.22',
2930
'2026.09.18',
30-
'2026.09.16',
3131
];
3232

3333
/// Sets the current runtime versions.

‎app/test/frontend/handlers/package_test.dart‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
import 'package:pub_dev/shared/redis_cache.dart';
56
import 'package:pub_dev/tool/test_profile/models.dart';
67
import 'package:test/test.dart';
78

@@ -126,6 +127,10 @@ void main() {
126127
await expectNotFoundResponse(
127128
await issueGet('/packages/oxygen/versions/0.1.2'),
128129
);
130+
expect(
131+
await cache.packageVersionAssetKinds('oxygen', '0.1.2').get(),
132+
isNull,
133+
);
129134
},
130135
);
131136

0 commit comments

Comments
 (0)