From 1f1d8355ad73eb9c0ab9aaeb069a21aecee78d6f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 24 Aug 2014 20:31:46 +0000 Subject: Fix timing issue with bbackupd test for recovery after error. For some reason the timing changed and the test was no longer waiting for the same length of time as bbackupd, causing it to fail. Merged back changes from the test refactor branch to reduce diffs. --- bin/bbackupd/BackupDaemon.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/bbackupd/BackupDaemon.cpp b/bin/bbackupd/BackupDaemon.cpp index bb022e44..0fca634c 100644 --- a/bin/bbackupd/BackupDaemon.cpp +++ b/bin/bbackupd/BackupDaemon.cpp @@ -61,6 +61,7 @@ #include "BackupClientFileAttributes.h" #include "BackupClientInodeToIDMap.h" #include "BackupClientMakeExcludeList.h" +#include "BackupConstants.h" #include "BackupDaemon.h" #include "BackupDaemonConfigVerify.h" #include "BackupStoreConstants.h" @@ -574,6 +575,7 @@ void BackupDaemon::Run2() box_time_t currentTime = GetCurrentBoxTime(); box_time_t requiredDelay = (mNextSyncTime < currentTime) ? (0) : (mNextSyncTime - currentTime); + mNextSyncTime = currentTime + requiredDelay; if (mDoSyncForcedByPreviousSyncError) { @@ -670,7 +672,7 @@ void BackupDaemon::Run2() if(d > 0) { // Script has asked for a delay - mNextSyncTime = GetCurrentBoxTime() + + mNextSyncTime = GetCurrentBoxTime() + SecondsToBoxTime(d); BOX_INFO("Impending backup stopped by " "SyncAllowScript, next attempt " @@ -779,9 +781,9 @@ void BackupDaemon::RunSyncNowWithExceptionHandling() " " << errorCode << "/" << errorSubCode << "), reset state and waiting to retry..."); ::sleep(10); - mNextSyncTime = mCurrentSyncStartTime + - SecondsToBoxTime(100) + - Random::RandomInt(mUpdateStoreInterval >> + mNextSyncTime = GetCurrentBoxTime() + + SecondsToBoxTime(BACKUP_ERROR_RETRY_SECONDS) + + Random::RandomInt(mUpdateStoreInterval >> SYNC_PERIOD_RANDOM_EXTRA_TIME_SHIFT_BY); } } -- cgit v1.2.3