if (myOps != NULL && !myOps->empty()) {
clientOpsType::iterator ptr = myOps->find(thisChan->getName());
if (ptr != myOps->end()) {
- delete myOps;
return;
}
}
{
clientOpsType* myOps = static_cast< clientOpsType* >(theClient->getCustomData(this) );
-if (!myOps) myOps = new clientOpsType;
+if (myOps == NULL) myOps = new clientOpsType;
return myOps;
}
Timer snapShotTimer;
snapShotTimer.Start();
- /* Has the snapshot map been allocated? if not, lets do! */
- if (snapShot == NULL)
- snapShot = new (std::nothrow) DBMapType;
-
/* Clear the snapShot map */
- snapShot->clear();
+ snapShot.clear();
//snapShotStruct* curStruct = new (std::nothrow) snapShotStruct;
snapShotStruct curStruct;
curStruct.day[i] = curOp->getDay(i);
}
- snapShot->insert(DBMapType::value_type(curChan, curStruct));
+ snapShot.insert(DBMapType::value_type(curChan, curStruct));
}
}
int chanOpsProcessed = 0;
int i = 0;
- for (DBMapType::iterator ptr = snapShot->begin();
- ptr != snapShot->end(); ptr++) {
+ for (DBMapType::iterator ptr = snapShot.begin();
+ ptr != snapShot.end(); ptr++) {
theLine.str("");
theLine << escapeSQLChars(ptr->first) << "\t"
<< escapeSQLChars(ptr->second.account) << "\t"
theManager->removeConnection(cacheCon);
/* Clean-up after ourselves and allow new updates to be started */
- snapShot->clear();
- delete snapShot; snapShot = 0;
+ snapShot.clear();
updateInProgress = false;
return;
Timer rotateDBTimer;
rotateDBTimer.Start();
+int deleteCount = 0;
+int errorCount = 0;
+
short nextDay = currentDay;
setCurrentDay();
if (nextDay >= (DAYSAMPLES - 1))
elog << "chanfix::rotateDB> Error: could not delete channel "
<< curChan.c_str()
<< std::endl;
+ errorCount++;
+ } else {
+ deleteCount++;
}
#ifdef REMEMBER_CHANNELS_WITH_NOTES_OR_FLAGS
}
logDebugMessage("Completed database rotation in %u ms.",
rotateDBTimer.stopTimeMS());
+logDebugMessage("%i channels were deleted. %i channels errored out while deleting.",
+ deleteCount,
+ errorCount);
+
return;
}