Commit b67adedc authored by Micha Mueller's avatar Micha Mueller
Browse files

Fix dcdbpusher not terminating if no thraeds executing sensor groups are available

parent 2436f553
......@@ -68,13 +68,24 @@ public:
/**
* Does a busy wait until all dispatched handlers are finished (_pendingTasks == 0)
* If the wait takes longer than a reasonable amount of time we return anyway,
* to not block termination of dcdbpusher.
*/
void wait() {
while(_pendingTasks) {
sleep(1);
unsigned short retries = 3;
for (unsigned short i = 1; i <= retries; i++) {
if (_pendingTasks) {
LOG(info) << "Group " << _groupName << " not yet finished. Waiting... (" << i << "/" << retries << ")";
sleep((_interval/1000) + 1);
} else {
return;
}
}
LOG(warning) << "Group " << _groupName << " will not finish! Skipping it";
}
//can be overwritten
virtual void init(boost::asio::io_service& io) {
_timer.reset(new boost::asio::deadline_timer(io, boost::posix_time::seconds(0)));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment