@@ -585,7 +585,7 @@ o2::framework::ServiceSpec CommonServices::decongestionSpec()
585585 }
586586 return ServiceHandle{TypeIdHelpers::uniqueId<DecongestionService>(), decongestion, ServiceKind::Serial};
587587 },
588- .postProcessing = [](ProcessingContext& ctx, void * service) {
588+ .postForwarding = [](ProcessingContext& ctx, void * service) {
589589 DecongestionService* decongestion = reinterpret_cast <DecongestionService*>(service);
590590 if (decongestion->isFirstInTopology == false ) {
591591 LOGP (debug, " We are not the first in the topology, do not update the oldest possible timeslice" );
@@ -610,6 +610,18 @@ o2::framework::ServiceSpec CommonServices::decongestionSpec()
610610 oldestPossibleOutput.slot .index == -1 ? " channel" : " slot" ,
611611 oldestPossibleOutput.slot .index == -1 ? oldestPossibleOutput.channel .value : oldestPossibleOutput.slot .index );
612612 DataProcessingHelpers::broadcastOldestPossibleTimeslice (proxy, oldestPossibleOutput.timeslice .value );
613+ DeviceSpec const & spec = ctx.services ().get <DeviceSpec const >();
614+ auto device = ctx.services ().get <RawDeviceService>().device ();
615+ for (size_t fi = 0 ; fi < spec.forwards .size (); fi++) {
616+ auto & channel = device->GetChannel (spec.forwards [fi].channel , 0 );
617+ // The oldest possible timeslice for a forwarded message
618+ // is conservatively the one of the device doing the forwarding.
619+ if (spec.forwards [fi].channel .rfind (" from_" , 0 ) == 0 ) {
620+ auto oldestTimeslice = timesliceIndex.getOldestPossibleOutput ();
621+ DataProcessingHelpers::sendOldestPossibleTimeframe (channel, oldestTimeslice.timeslice .value );
622+ LOGP (debug, " Forwarding to channel {} oldest possible timeslice {}" , spec.forwards [fi].channel , oldestTimeslice.timeslice .value );
623+ }
624+ }
613625 decongestion->lastTimeslice = oldestPossibleOutput.timeslice .value ; },
614626 .domainInfoUpdated = [](ServiceRegistry& services, size_t oldestPossibleTimeslice, ChannelIndex channel) {
615627 DecongestionService& decongestion = services.get <DecongestionService>();
@@ -632,6 +644,18 @@ o2::framework::ServiceSpec CommonServices::decongestionSpec()
632644 }
633645 LOGP (debug, " Broadcasting possible output {}" , oldestPossibleOutput.timeslice .value );
634646 DataProcessingHelpers::broadcastOldestPossibleTimeslice (proxy, oldestPossibleOutput.timeslice .value );
647+ DeviceSpec const & spec = services.get <DeviceSpec const >();
648+ auto device = services.get <RawDeviceService>().device ();
649+ for (size_t fi = 0 ; fi < spec.forwards .size (); fi++) {
650+ auto & channel = device->GetChannel (spec.forwards [fi].channel , 0 );
651+ // The oldest possible timeslice for a forwarded message
652+ // is conservatively the one of the device doing the forwarding.
653+ if (spec.forwards [fi].channel .rfind (" from_" , 0 ) == 0 ) {
654+ auto oldestTimeslice = timesliceIndex.getOldestPossibleOutput ();
655+ LOGP (info, " Forwarding to channel {} oldest possible timeslice {}" , spec.forwards [fi].channel , oldestTimeslice.timeslice .value );
656+ DataProcessingHelpers::sendOldestPossibleTimeframe (channel, oldestTimeslice.timeslice .value );
657+ }
658+ }
635659 decongestion.lastTimeslice = oldestPossibleOutput.timeslice .value ; },
636660 .kind = ServiceKind::Serial};
637661}
0 commit comments