Skip to content

Commit b5132e4

Browse files
committed
Stop CTFreader asap to avoid empty run cycle
1 parent ce9f343 commit b5132e4

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

Detectors/CTF/workflow/src/CTFReaderSpec.cxx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,6 @@ void CTFReaderSpec::run(ProcessingContext& pc)
195195
mInput.tfRateLimit = std::stoi(pc.services().get<RawDeviceService>().device()->fConfig->GetValue<std::string>("timeframes-rate-limit"));
196196
}
197197
std::string tfFileName;
198-
if (mCTFCounter >= mInput.maxTFs || (!mInput.ctfIDs.empty() && mSelIDEntry >= mInput.ctfIDs.size())) { // done
199-
LOG(info) << "All CTFs from selected range were injected, stopping";
200-
mRunning = false;
201-
}
202198

203199
while (mRunning) {
204200
if (mCTFTree) { // there is a tree open with multiple CTF
@@ -228,6 +224,14 @@ void CTFReaderSpec::run(ProcessingContext& pc)
228224
LOG(info) << "Reading CTF input " << ' ' << tfFileName;
229225
openCTFFile(tfFileName);
230226
}
227+
228+
if (mCTFCounter >= mInput.maxTFs || (!mInput.ctfIDs.empty() && mSelIDEntry >= mInput.ctfIDs.size())) { // done
229+
LOG(info) << "All CTFs from selected range were injected, stopping";
230+
mRunning = false;
231+
} else if (mRunning && !mCTFTree && mFileFetcher->getNextFileInQueue().empty()) { // previous tree was done, can we read more?
232+
mRunning = false;
233+
}
234+
231235
if (!mRunning) {
232236
pc.services().get<ControlService>().endOfStream();
233237
pc.services().get<ControlService>().readyToQuit(QuitRequest::Me);

0 commit comments

Comments
 (0)