fixed - improved handling of totSent
@@ -287,8 +287,8 @@ static void loadDataThread(SendingProcess *loadData)
*/
static void sendDataThread(SendingProcess *sendData)
{
+ unsigned long totSent = 0;
unsigned int sendIdx = 0;
- sendData->resetSentReadings();
while (sendData->isRunning())
{
@@ -300,6 +300,12 @@ static void sendDataThread(SendingProcess *sendData)
// Update counters to Database
sendData->updateDatabaseCounters();
+ // numReadings sent so far
+ totSent = sendData->getSentReadings();
+
+ // Reset current sent readings
+ sendData->resetSentReadings();
+
// DB update done
sendData->setUpdateDb(false);
}
@@ -329,6 +335,12 @@ static void sendDataThread(SendingProcess *sendData)
// Update counters to Database
sendData->updateDatabaseCounters();
+ // numReadings sent so far
+ totSent = sendData->getSentReadings();
+
+ // Reset current sent readings
+ sendData->resetSentReadings();
+
// DB update done
sendData->setUpdateDb(false);
}
@@ -373,6 +385,9 @@ static void sendDataThread(SendingProcess *sendData)
/** 2- Update sent counter (memory only) */
sendData->updateSentReadings(sentReadings);
+ // numReadings sent so far
+ totSent = sendData->getSentReadings();
+
readMutex.unlock();
sendIdx++;
@@ -395,6 +410,12 @@ static void sendDataThread(SendingProcess *sendData)
// Update counters to Database
sendData->updateDatabaseCounters();
+ // numReadings sent so far
+ totSent = sendData->getSentReadings();
+
+ // Reset current sent readings
+ sendData->resetSentReadings();
+
// DB update done
sendData->setUpdateDb(false);
}
@@ -406,7 +427,7 @@ static void sendDataThread(SendingProcess *sendData)
}
}
Logger::getLogger()->info("SendingProcess sendData thread: sent %lu total '%s'",
- sendData->getSentReadings(),
+ totSent,
sendData->getDataSourceType().c_str());
if (sendData->getUpdateDb())
@@ -414,6 +435,12 @@ static void sendDataThread(SendingProcess *sendData)
// Update counters to Database
sendData->updateDatabaseCounters();
+ // numReadings sent so far
+ totSent = sendData->getSentReadings();
+
+ // Reset current sent readings
+ sendData->resetSentReadings();
+
sendData->setUpdateDb(false);
}
