mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
Tests for MQ examples
This commit is contained in:
committed by
Mohammad Al-Turany
parent
984eed1a89
commit
319bdc91a1
@@ -13,9 +13,16 @@
|
||||
using namespace std;
|
||||
|
||||
FairMQExampleMTSampler2::FairMQExampleMTSampler2()
|
||||
: fMaxIterations(0)
|
||||
, fNumIterations(0)
|
||||
{
|
||||
}
|
||||
|
||||
void FairMQExampleMTSampler2::InitTask()
|
||||
{
|
||||
fMaxIterations = fConfig->GetValue<uint64_t>("max-iterations");
|
||||
}
|
||||
|
||||
bool FairMQExampleMTSampler2::ConditionalRun()
|
||||
{
|
||||
FairMQMessagePtr msg(NewMessage(1000));
|
||||
@@ -27,6 +34,12 @@ bool FairMQExampleMTSampler2::ConditionalRun()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fMaxIterations > 0 && ++fNumIterations >= fMaxIterations)
|
||||
{
|
||||
LOG(INFO) << "Configured maximum number of iterations reached. Leaving RUNNING state.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user