Skip to content

Commit

Permalink
Stop CTFreader asap to avoid empty run cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
shahor02 committed Sep 29, 2023
1 parent ce9f343 commit b5132e4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Detectors/CTF/workflow/src/CTFReaderSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ void CTFReaderSpec::run(ProcessingContext& pc)
mInput.tfRateLimit = std::stoi(pc.services().get<RawDeviceService>().device()->fConfig->GetValue<std::string>("timeframes-rate-limit"));
}
std::string tfFileName;
if (mCTFCounter >= mInput.maxTFs || (!mInput.ctfIDs.empty() && mSelIDEntry >= mInput.ctfIDs.size())) { // done
LOG(info) << "All CTFs from selected range were injected, stopping";
mRunning = false;
}

while (mRunning) {
if (mCTFTree) { // there is a tree open with multiple CTF
Expand Down Expand Up @@ -228,6 +224,14 @@ void CTFReaderSpec::run(ProcessingContext& pc)
LOG(info) << "Reading CTF input " << ' ' << tfFileName;
openCTFFile(tfFileName);
}

if (mCTFCounter >= mInput.maxTFs || (!mInput.ctfIDs.empty() && mSelIDEntry >= mInput.ctfIDs.size())) { // done
LOG(info) << "All CTFs from selected range were injected, stopping";
mRunning = false;
} else if (mRunning && !mCTFTree && mFileFetcher->getNextFileInQueue().empty()) { // previous tree was done, can we read more?
mRunning = false;
}

if (!mRunning) {
pc.services().get<ControlService>().endOfStream();
pc.services().get<ControlService>().readyToQuit(QuitRequest::Me);
Expand Down

0 comments on commit b5132e4

Please sign in to comment.