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

Unified Diff: components/sync/engine_impl/syncer_proto_util.cc

Issue 2475043002: [Sync] Sync client should to exponential backoff when receive partial failure (Closed)
Patch Set: rebase Created 4 years, 1 month 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
Index: components/sync/engine_impl/syncer_proto_util.cc
diff --git a/components/sync/engine_impl/syncer_proto_util.cc b/components/sync/engine_impl/syncer_proto_util.cc
index 9efd929169bc7425fe6ac591713d0e441813f31a..476ded98e016891f1ff40795c366b1ab8ffece3a 100644
--- a/components/sync/engine_impl/syncer_proto_util.cc
+++ b/components/sync/engine_impl/syncer_proto_util.cc
@@ -472,9 +472,15 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage(
DLOG(WARNING) << "Client fully throttled by syncer.";
cycle->delegate()->OnThrottled(GetThrottleDelay(*response));
} else {
+ // This is a special case, since server only throttle some of datatype,
+ // so can treat this case as partial failure.
DLOG(WARNING) << "Some types throttled by syncer.";
cycle->delegate()->OnTypesThrottled(
sync_protocol_error.error_data_types, GetThrottleDelay(*response));
+ if (partial_failure_data_types != nullptr) {
+ *partial_failure_data_types = sync_protocol_error.error_data_types;
+ }
+ return SYNCER_OK;
}
return SERVER_RETURN_THROTTLED;
case TRANSIENT_ERROR:
@@ -492,16 +498,17 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage(
case DISABLED_BY_ADMIN:
return SERVER_RETURN_DISABLED_BY_ADMIN;
case PARTIAL_FAILURE:
- // This only happens when partial throttling during GetUpdates.
+ // This only happens when partial backoff during GetUpdates.
if (!sync_protocol_error.error_data_types.Empty()) {
- DLOG(WARNING) << "Some types throttled by syncer during GetUpdates.";
- cycle->delegate()->OnTypesThrottled(
- sync_protocol_error.error_data_types, GetThrottleDelay(*response));
+ DLOG(WARNING)
+ << "Some types got partial failure by syncer during GetUpdates.";
+ cycle->delegate()->OnTypesBackedOff(
+ sync_protocol_error.error_data_types);
}
if (partial_failure_data_types != nullptr) {
*partial_failure_data_types = sync_protocol_error.error_data_types;
}
- return SERVER_RETURN_PARTIAL_FAILURE;
+ return SYNCER_OK;
case CLIENT_DATA_OBSOLETE:
return SERVER_RETURN_CLIENT_DATA_OBSOLETE;
default:
« no previous file with comments | « components/sync/engine_impl/sync_scheduler_impl_unittest.cc ('k') | components/sync/engine_impl/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698