mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
check if update timestamps list is empty after removing all outdated entrys
This commit is contained in:
parent
03f619fac1
commit
ae096e2d2e
@ -67,7 +67,10 @@ void CronManager::runUpdateStep(Poco::Timer& timer)
|
||||
|
||||
mTimestampsMutex.lock();
|
||||
//printf("update timestamp sizes: %d\n", mUpdateTimestamps.size());
|
||||
if (mUpdateTimestamps.size() > 0) {
|
||||
bool timerRestarted = false;
|
||||
|
||||
if (mUpdateTimestamps.size() > 0)
|
||||
{
|
||||
Poco::Timestamp now;
|
||||
// update maximal once per second
|
||||
now += Poco::Timespan(1, 0);
|
||||
@ -75,19 +78,21 @@ void CronManager::runUpdateStep(Poco::Timer& timer)
|
||||
// printf("remove update time in past: %d\n", mUpdateTimestamps.front().epochTime());
|
||||
mUpdateTimestamps.pop_front();
|
||||
}
|
||||
if (mUpdateTimestamps.size() > 0) {
|
||||
Poco::Timespan next_run = mUpdateTimestamps.front() - now;
|
||||
//printf("timer restart called with: %d\n", next_run.seconds());
|
||||
//mMainTimer.setPeriodicInterval(next_run.totalMilliseconds());
|
||||
mMainTimer.restart(next_run.totalMilliseconds());
|
||||
mUpdateTimestamps.pop_front();
|
||||
timerRestarted = true;
|
||||
}
|
||||
else {
|
||||
if (mMainTimer.getPeriodicInterval() != mDefaultIntervalMilliseconds) {
|
||||
}
|
||||
|
||||
if (!timerRestarted && mMainTimer.getPeriodicInterval() != mDefaultIntervalMilliseconds) {
|
||||
//printf("reset to default interval\n");
|
||||
mMainTimer.setPeriodicInterval(mDefaultIntervalMilliseconds);
|
||||
//mMainTimer.restart(mDefaultIntervalMilliseconds);
|
||||
}
|
||||
}
|
||||
mTimestampsMutex.unlock();
|
||||
//printf("[CronManager::runUpdateStep] end\n");
|
||||
}
|
||||
@ -188,8 +193,8 @@ int PingServerTask::run()
|
||||
std::string url_port = mNodeServer->getModel()->getUrlWithPort();
|
||||
printf("%s [PingServerTask::run] call update for %s\n", Poco::DateTimeFormatter::format(current, "%d.%m.%y %H:%M:%S.%i").data(), url_port.data());
|
||||
|
||||
auto json_request = mNodeServer->createJsonRequest();
|
||||
json_request.request("updateReadNode");
|
||||
//auto json_request = mNodeServer->createJsonRequest();
|
||||
//json_request.request("updateReadNode");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user