Skip to content

Commit

Permalink
Adress PR comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
herve-er committed Jan 6, 2025
1 parent 1562bdf commit 8b24d31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions test/libsyncengine/jobs/testjobmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ void TestJobManager::testCancelJobs() {

cancelAllOngoingJobs();

int rerty = 1000; // Wait max 10sec
int retry = 1000; // Wait max 10sec
while ((!JobManager::_managedJobs.empty() || !JobManager::_queuedJobs.empty() || !JobManager::_runningJobs.empty() ||
!JobManager::_pendingJobs.empty()) &&
(rerty > 0)) {
rerty--;
(retry > 0)) {
retry--;
Utility::msleep(10);
}

Expand All @@ -216,7 +216,7 @@ void TestJobManager::testCancelJobs() {
CPPUNIT_ASSERT(resObj);

Poco::JSON::Array::Ptr data = resObj->getArray(dataKey);
size_t uploadedFileCounter = data->size();
const size_t uploadedFileCounter = data->size();
CPPUNIT_ASSERT(localFileCounter != uploadedFileCounter);
CPPUNIT_ASSERT(uploadedFileCounter > 0);
CPPUNIT_ASSERT(ongoingJobsCount() == 0);
Expand Down
6 changes: 2 additions & 4 deletions test/test_utility/remotetemporarydirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ namespace KDC {
RemoteTemporaryDirectory::RemoteTemporaryDirectory(int driveDbId, const NodeId& parentId,
const std::string& testType /*= "undef"*/) :
_driveDbId(driveDbId) {
std::string suffix = CommonUtility::generateRandomStringAlphaNum(5);
int retry = 5;
do {
std::string suffix = CommonUtility::generateRandomStringAlphaNum(5);
// Generate directory name
const std::time_t now = std::time(nullptr);
const std::tm tm = *std::localtime(&now);
Expand All @@ -43,7 +43,6 @@ RemoteTemporaryDirectory::RemoteTemporaryDirectory(int driveDbId, const NodeId&
CreateDirJob job(_driveDbId, parentId, _dirName);
job.runSynchronously();
if (job.exitInfo() == ExitInfo(ExitCode::BackError, ExitCause::FileAlreadyExist) && retry > 0) {
suffix = CommonUtility::generateRandomStringAlphaNum(5);
retry--;
continue;
}
Expand All @@ -56,8 +55,7 @@ RemoteTemporaryDirectory::RemoteTemporaryDirectory(int driveDbId, const NodeId&
CPPUNIT_ASSERT(dataObj);
_dirId = dataObj->get(idKey).toString();
LOGW_INFO(Log::instance()->getLogger(), L"RemoteTemporaryDirectory created: " << Utility::formatSyncName(_dirName)
<< L" with ID: "
<< Utility::s2ws(_dirId));
<< L" with ID: " << Utility::s2ws(_dirId));
break;
} while (true);
}
Expand Down

0 comments on commit 8b24d31

Please sign in to comment.