Index: chrome/browser/sync/engine/syncer_proto_util.cc |
diff --git a/chrome/browser/sync/engine/syncer_proto_util.cc b/chrome/browser/sync/engine/syncer_proto_util.cc |
index 6dae7689f12e54886bdb2e3844ff305f598fc48b..87eae4efe836043172d05cee6508ebfa38bccad0 100644 |
--- a/chrome/browser/sync/engine/syncer_proto_util.cc |
+++ b/chrome/browser/sync/engine/syncer_proto_util.cc |
@@ -11,6 +11,7 @@ |
#include "chrome/browser/sync/engine/syncer_types.h" |
#include "chrome/browser/sync/engine/syncer_util.h" |
#include "chrome/browser/sync/protocol/service_constants.h" |
+#include "chrome/browser/sync/protocol/sync.pb.h" |
#include "chrome/browser/sync/sessions/sync_session.h" |
#include "chrome/browser/sync/syncable/directory_manager.h" |
#include "chrome/browser/sync/syncable/model_type.h" |
@@ -182,6 +183,17 @@ bool SyncerProtoUtil::PostAndProcessHeaders(ServerConnectionManager* scm, |
return false; |
} |
+base::TimeDelta SyncerProtoUtil::GetThrottleDelay( |
+ const sync_pb::ClientToServerResponse& response) { |
+ if (!response.has_client_command()) |
+ return base::TimeDelta::FromSeconds(kSyncDelayAfterThrottled); |
+ const sync_pb::ClientCommand& command = response.client_command(); |
+ if (command.has_throttle_delay_seconds()) |
+ return base::TimeDelta::FromSeconds(command.throttle_delay_seconds()); |
+ else |
+ return base::TimeDelta::FromSeconds(kSyncDelayAfterThrottled); |
akalin
2011/08/10 19:48:14
i don't like repeating the constant twice. How ab
lipalani1
2011/08/10 20:38:58
Done.
|
+} |
+ |
namespace { |
// Helper function for an assertion in PostClientToServerMessage. |
@@ -236,7 +248,7 @@ bool SyncerProtoUtil::PostClientToServerMessage( |
case ClientToServerResponse::THROTTLED: |
LOG(WARNING) << "Client silenced by server."; |
session->delegate()->OnSilencedUntil(base::TimeTicks::Now() + |
- base::TimeDelta::FromSeconds(kSyncDelayAfterThrottled)); |
+ GetThrottleDelay(*response)); |
return false; |
case ClientToServerResponse::TRANSIENT_ERROR: |
return false; |