@@ -409,13 +409,13 @@ void WorkflowHelpers::injectServiceDevices(WorkflowSpec& workflow, ConfigContext
409409 extraSpecs.push_back (indexBuilder);
410410 }
411411
412+ auto tfnsource = std::ranges::find_if (workflow, [](DataProcessorSpec const & spec) {
413+ return std::ranges::any_of (spec.outputs , [](OutputSpec const & output) {
414+ return DataSpecUtils::match (output, " TFN" , " TFNumber" , 0 );
415+ });
416+ });
412417 // add the reader
413418 if (aodReader.outputs .empty () == false ) {
414- auto tfnsource = std::ranges::find_if (workflow, [](DataProcessorSpec const & spec) {
415- return std::ranges::any_of (spec.outputs , [](OutputSpec const & output) {
416- return DataSpecUtils::match (output, " TFN" , " TFNumber" , 0 );
417- });
418- });
419419 if (tfnsource == workflow.end ()) {
420420 // add normal reader
421421 aodReader.outputs .emplace_back (OutputSpec{" TFN" , " TFNumber" });
@@ -557,6 +557,12 @@ void WorkflowHelpers::injectServiceDevices(WorkflowSpec& workflow, ConfigContext
557557
558558 std::vector<InputSpec> unmatched;
559559 auto forwardingDestination = ctx.options ().get <std::string>(" forwarding-destination" );
560+ // update tfnsource iterator (could be aod-reader)
561+ tfnsource = std::ranges::find_if (workflow, [](DataProcessorSpec const & spec) {
562+ return std::ranges::any_of (spec.outputs , [](OutputSpec const & output) {
563+ return DataSpecUtils::match (output, " TFN" , " TFNumber" , 0 );
564+ });
565+ });
560566 if (redirectedOutputsInputs.size () > 0 && forwardingDestination == " file" ) {
561567 auto fileSink = CommonDataProcessors::getGlobalFileSink (redirectedOutputsInputs, unmatched);
562568 if (unmatched.size () != redirectedOutputsInputs.size ()) {
@@ -568,7 +574,7 @@ void WorkflowHelpers::injectServiceDevices(WorkflowSpec& workflow, ConfigContext
568574 } else if (forwardingDestination != " drop" ) {
569575 throw runtime_error_f (" Unknown forwarding destination %s" , forwardingDestination.c_str ());
570576 }
571- if (unmatched.size () > 0 || redirectedOutputsInputs.size () > 0 ) {
577+ if (( unmatched.size () > 0 ) || ( redirectedOutputsInputs.size () > 0 ) || (tfnsource != workflow. end ()) ) {
572578 std::vector<InputSpec> ignored = unmatched;
573579 ignored.insert (ignored.end (), redirectedOutputsInputs.begin (), redirectedOutputsInputs.end ());
574580 for (auto & ignoredInput : ignored) {
@@ -577,8 +583,11 @@ void WorkflowHelpers::injectServiceDevices(WorkflowSpec& workflow, ConfigContext
577583
578584 // Use the new dummy sink when the AOD reader is there
579585 O2_SIGNPOST_ID_GENERATE (sid, workflow_helpers);
580- if (aodReader. outputs . empty () == false ) {
586+ if (tfnsource != workflow. end () ) {
581587 O2_SIGNPOST_EVENT_EMIT (workflow_helpers, sid, " injectServiceDevices" , " Injecting scheduled dummy sink" );
588+ // if there is a tfnsource, make sure the sink has
589+ ignored.emplace_back (" tfn" , " TFN" , " TFNumber" );
590+ ignored.emplace_back (" tff" , " TFF" , " TFFilename" );
582591 extraSpecs.push_back (CommonDataProcessors::getScheduledDummySink (ignored));
583592 } else {
584593 O2_SIGNPOST_EVENT_EMIT (workflow_helpers, sid, " injectServiceDevices" , " Injecting rate limited dummy sink" );
0 commit comments