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

Side by Side Diff: chrome/browser/sync/engine/sync_scheduler.cc

Issue 9372051: Don't retry failed attempts to poll sync server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor comment updates Created 8 years, 10 months 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
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 "chrome/browser/sync/engine/sync_scheduler.h" 5 #include "chrome/browser/sync/engine/sync_scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 SDVLOG(2) << "Job succeeded so not scheduling more jobs"; 894 SDVLOG(2) << "Job succeeded so not scheduling more jobs";
895 return; 895 return;
896 } 896 }
897 897
898 // TODO(rlarocque): There's no reason why we should blindly backoff and retry 898 // TODO(rlarocque): There's no reason why we should blindly backoff and retry
899 // if we don't succeed. Some types of errors are not likely to disappear on 899 // if we don't succeed. Some types of errors are not likely to disappear on
900 // their own. With the return values now available in the old_job.session, we 900 // their own. With the return values now available in the old_job.session, we
901 // should be able to detect such errors and only retry when we detect 901 // should be able to detect such errors and only retry when we detect
902 // transient errors. 902 // transient errors.
903 903
904 // We are in backoff mode and our time did not run out. That means we had 904 if (old_job.purpose == SyncSessionJob::POLL) {
905 // a local change, notification from server or a network connection change 905 // We don't retry POLL jobs.
tim (not reviewing) 2012/02/14 01:05:32 Hm, maybe our chat on IM confused me a bit. Decide
rlarocque 2012/02/14 01:59:36 If we didn't have this if statement, we would save
tim (not reviewing) 2012/02/15 02:21:29 It does rely on whether or not we're in a wait int
rlarocque 2012/02/17 20:51:02 Lots of minor points:
906 // notification. In any case set had_nudge = true so we dont retry next 906 } else if (IsBackingOff() && wait_interval_->timer.IsRunning() &&
907 // nudge. Note: we will keep retrying network connection changes though as
908 // they are treated as canary jobs. Also we check the mode here because
909 // we want to do this only in normal mode. For config mode jobs we dont
910 // have anything similar to had_nudge.
911 if (IsBackingOff() && wait_interval_->timer.IsRunning() &&
912 mode_ == NORMAL_MODE) { 907 mode_ == NORMAL_MODE) {
908 // When in normal mode, we allow up to one nudge per backoff interval. It
909 // appears that this was our nudge for this interval, and it failed.
910 //
911 // Note: This does not prevent us from running canary jobs. For example, an
912 // IP address change might still result in another nudge being executed
913 // during this backoff interval.
913 SDVLOG(2) << "A nudge during backoff failed"; 914 SDVLOG(2) << "A nudge during backoff failed";
914 // We weren't continuing but we're in backoff; must have been a nudge. 915
915 DCHECK_EQ(SyncSessionJob::NUDGE, old_job.purpose); 916 DCHECK_EQ(SyncSessionJob::NUDGE, old_job.purpose);
916 DCHECK(!wait_interval_->had_nudge); 917 DCHECK(!wait_interval_->had_nudge);
918
917 wait_interval_->had_nudge = true; 919 wait_interval_->had_nudge = true;
918 // Old job did not finish. So make it the pending job.
919 InitOrCoalescePendingJob(old_job); 920 InitOrCoalescePendingJob(old_job);
920 // Resume waiting.
921 RestartWaiting(); 921 RestartWaiting();
922 } else { 922 } else {
923 // Either this is the first failure or a consecutive failure after our
924 // backoff timer expired. We handle it the same way in either case.
923 SDVLOG(2) << "Non-'backoff nudge' SyncShare job failed"; 925 SDVLOG(2) << "Non-'backoff nudge' SyncShare job failed";
924 // We don't seem to have made forward progress. Start or extend backoff.
925 HandleContinuationError(old_job); 926 HandleContinuationError(old_job);
926 } 927 }
927 } 928 }
928 929
929 void SyncScheduler::AdjustPolling(const SyncSessionJob* old_job) { 930 void SyncScheduler::AdjustPolling(const SyncSessionJob* old_job) {
930 DCHECK_EQ(MessageLoop::current(), sync_loop_); 931 DCHECK_EQ(MessageLoop::current(), sync_loop_);
931 932
932 TimeDelta poll = (!session_context_->notifications_enabled()) ? 933 TimeDelta poll = (!session_context_->notifications_enabled()) ?
933 syncer_short_poll_interval_seconds_ : 934 syncer_short_poll_interval_seconds_ :
934 syncer_long_poll_interval_seconds_; 935 syncer_long_poll_interval_seconds_;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 1201
1201 #undef SDVLOG_LOC 1202 #undef SDVLOG_LOC
1202 1203
1203 #undef SDVLOG 1204 #undef SDVLOG
1204 1205
1205 #undef SLOG 1206 #undef SLOG
1206 1207
1207 #undef ENUM_CASE 1208 #undef ENUM_CASE
1208 1209
1209 } // browser_sync 1210 } // browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/sync_scheduler.h ('k') | chrome/browser/sync/engine/sync_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698