Skip to content

Commit

Permalink
Non-nullable model fields in task/models.dart (dart-lang#8469)
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos authored Jan 16, 2025
1 parent f43044b commit 77da838
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
4 changes: 1 addition & 3 deletions app/lib/search/backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,7 @@ class SearchBackend {
..filter('finished >=', updatedThreshold)
..order('-finished');
await for (final s in q3.run()) {
if (s.finished != null) {
addResult(s.package, s.finished!);
}
addResult(s.package, s.finished);
}

return results;
Expand Down
5 changes: 1 addition & 4 deletions app/lib/task/backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ class TaskBackend {
return await _loadTaskResultIndex(
package: package,
version: version,
runtimeVersion: status.runtimeVersion ?? runtimeVersion,
runtimeVersion: status.runtimeVersion,
);
},
);
Expand Down Expand Up @@ -986,9 +986,6 @@ class TaskBackend {
final data = await gzippedTaskResult(package, version, 'log.txt');
if (data == null) {
final status = await packageStatus(package);
if (status.runtimeVersion == null) {
return 'no log - no tracking information';
}
final v = status.versions[version];
if (v == null) {
return 'no log - version is not tracked';
Expand Down
8 changes: 3 additions & 5 deletions app/lib/task/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,8 @@ class PackageState extends db.ExpandoModel<String> {
DateTime? lastDependencyChanged;

/// The last time the a worker completed with a failure or success.
/// TODO: make it `required: true` after the acceptable runtimes are after 2023.08.18.
@db.DateTimeProperty(required: false, indexed: true)
DateTime? finished;
@db.DateTimeProperty(required: true, indexed: true)
DateTime finished = initialTimestamp;

/// Derive [pendingAt] using [versions] and [lastDependencyChanged].
///
Expand Down Expand Up @@ -370,8 +369,7 @@ class PackageVersionStateMapProperty extends db.Property {
/// Status for a package.
@JsonSerializable()
class PackageStateInfo {
// TODO: make this non-nullable after we are past 2023.08.18 as accepted runtimeVersion.
final String? runtimeVersion;
final String runtimeVersion;
final String package;

/// Status for versions.
Expand Down
2 changes: 1 addition & 1 deletion app/lib/task/models.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 77da838

Please sign in to comment.