Workaround fix for performance benchmarks dashboard with limited data (#689)
* workaround fix for performance dashboard
* dartfmt
diff --git a/app_dart/lib/src/request_handlers/get_timeseries_history.dart b/app_dart/lib/src/request_handlers/get_timeseries_history.dart
index a4e9b76..4c94e85 100644
--- a/app_dart/lib/src/request_handlers/get_timeseries_history.dart
+++ b/app_dart/lib/src/request_handlers/get_timeseries_history.dart
@@ -44,7 +44,7 @@
final KeyHelper keyHelper = KeyHelper(
applicationContext: AppEngineContext(false, '', '', '', '', '', Uri()));
final Set<Commit> commits =
- await datastore.queryRecentCommits(limit: maxRecords).toSet();
+ await datastore.queryRecentCommitsNoBranch(limit: maxRecords).toSet();
Key timeSeriesKey;
try {
diff --git a/app_dart/lib/src/service/datastore.dart b/app_dart/lib/src/service/datastore.dart
index aac5b92..7c5630f 100644
--- a/app_dart/lib/src/service/datastore.dart
+++ b/app_dart/lib/src/service/datastore.dart
@@ -55,6 +55,18 @@
return query.run();
}
+ // Queries for recent commits without considering branches.
+ // TODO(keyonghan): combine this function with the above `queryRecentCommits`,
+ // this needs to fix https://github.com/flutter/flutter/issues/52694.
+ Stream<Commit> queryRecentCommitsNoBranch({int limit = 100, int timestamp}) {
+ timestamp ??= DateTime.now().millisecondsSinceEpoch;
+ final Query<Commit> query = db.query<Commit>()
+ ..limit(limit)
+ ..order('-timestamp')
+ ..filter('timestamp <', timestamp);
+ return query.run();
+ }
+
/// queryRecentTimeSerialsValues fetches the latest benchmark results starting from
/// [startFrom] and up to a given [limit].
///