don't log repeated exceptions

This commit is contained in:
Johannes Pohl 2016-11-24 17:21:39 +01:00
parent 9ec135e1b8
commit 8cf069642d
2 changed files with 16 additions and 3 deletions

View file

@ -146,8 +146,8 @@ void ProcessStream::worker()
{
timeval tvChunk;
std::unique_ptr<msg::PcmChunk> chunk(new msg::PcmChunk(sampleFormat_, pcmReadMs_));
setState(kPlaying);
string lastException = "";
while (active_)
{
@ -208,11 +208,17 @@ void ProcessStream::worker()
pcmListener_->onResync(this, currentTick - nextTick);
nextTick = currentTick;
}
lastException = "";
}
}
catch(const std::exception& e)
{
logE << "(ProcessStream) Exception: " << e.what() << std::endl;
if (lastException != e.what())
{
logE << "(PipeStream) Exception: " << e.what() << std::endl;
lastException = e.what();
}
process_->kill();
if (!sleep(30000))
break;