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

Side by Side Diff: sync/engine/backoff_delay_provider.cc

Issue 11411041: sync: Retry soon when server returns conflict (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sync/engine/backoff_delay_provider_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/engine/backoff_delay_provider.h" 5 #include "sync/engine/backoff_delay_provider.h"
6 6
7 #include "base/rand_util.h" 7 #include "base/rand_util.h"
8 #include "sync/internal_api/public/engine/polling_constants.h" 8 #include "sync/internal_api/public/engine/polling_constants.h"
9 #include "sync/internal_api/public/sessions/model_neutral_state.h" 9 #include "sync/internal_api/public/sessions/model_neutral_state.h"
10 #include "sync/internal_api/public/util/syncer_error.h" 10 #include "sync/internal_api/public/util/syncer_error.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Note: If we received a MIGRATION_DONE on download updates, then commit 90 // Note: If we received a MIGRATION_DONE on download updates, then commit
91 // should not have taken place. Moreover, if we receive a MIGRATION_DONE 91 // should not have taken place. Moreover, if we receive a MIGRATION_DONE
92 // on commit, it means that download updates succeeded. Therefore, we only 92 // on commit, it means that download updates succeeded. Therefore, we only
93 // need to check if either code is equal to SERVER_RETURN_MIGRATION_DONE, 93 // need to check if either code is equal to SERVER_RETURN_MIGRATION_DONE,
94 // and not if there were any more serious errors requiring the long retry. 94 // and not if there were any more serious errors requiring the long retry.
95 if (state.last_download_updates_result == SERVER_RETURN_MIGRATION_DONE || 95 if (state.last_download_updates_result == SERVER_RETURN_MIGRATION_DONE ||
96 state.commit_result == SERVER_RETURN_MIGRATION_DONE) { 96 state.commit_result == SERVER_RETURN_MIGRATION_DONE) {
97 return short_initial_backoff_; 97 return short_initial_backoff_;
98 } 98 }
99 99
100 // When the server tells us we have a conflict, then we should download the
101 // latest updates so we can see the conflict ourselves, resolve it locally,
102 // then try again to commit. Running another sync cycle will do all these
103 // things. There's no need to back off, we can do this immediately.
tim (not reviewing) 2012/11/21 21:37:18 I agree this solution is safe and easy and we shou
104 if (state.commit_result == SERVER_RETURN_CONFLICT) {
105 return short_initial_backoff_;
106 }
107
100 return default_initial_backoff_; 108 return default_initial_backoff_;
101 } 109 }
102 110
103 } // namespace syncer 111 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | sync/engine/backoff_delay_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698