Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Unified Diff: components/metrics/metrics_service.cc

Issue 799613002: Fix a bug that causes the metrics loop to be broken. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/metrics_service.cc
diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc
index adb8f2cd7cc11b97bb05194a7fca46ca16a78976..18ec2e55bddae79355348dcc22bbf3e848231092 100644
--- a/components/metrics/metrics_service.cc
+++ b/components/metrics/metrics_service.cc
@@ -1052,6 +1052,8 @@ void MetricsService::OnLogUploadComplete(int response_code) {
ResponseCodeToStatus(response_code),
NUM_RESPONSE_STATUSES);
+ bool suppress_reschedule = false;
+
bool upload_succeeded = response_code == 200;
// Provide boolean for error recovery (allow us to ignore response_code).
@@ -1085,6 +1087,7 @@ void MetricsService::OnLogUploadComplete(int response_code) {
log_manager_.StageNextLogForUpload();
SendStagedLog();
state_ = SENDING_INITIAL_METRICS_LOG;
+ suppress_reschedule = true;
}
break;
@@ -1113,10 +1116,10 @@ void MetricsService::OnLogUploadComplete(int response_code) {
// Error 400 indicates a problem with the log, not with the server, so
// don't consider that a sign that the server is in trouble.
bool server_is_healthy = upload_succeeded || response_code == 400;
- // Don't notify the scheduler that the upload is finished if we've only sent
- // the initial stability log, but not yet the initial metrics log (treat the
- // two as a single unit of work as far as the scheduler is concerned).
- if (state_ != SENDING_INITIAL_METRICS_LOG) {
+ // Don't notify the scheduler that the upload is finished if we've only just
+ // sent the initial stability log, but not yet the initial metrics log (treat
+ // the two as a single unit of work as far as the scheduler is concerned).
+ if (!suppress_reschedule) {
scheduler_->UploadFinished(server_is_healthy,
log_manager_.has_unsent_logs());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698