@@ -551,6 +551,7 @@ bool runcpp2::SetupDependenciesIfNeeded(const runcpp2::Data::Profile& profile,
551551 return false ;
552552
553553 std::vector<std::future<bool >> actions;
554+ std::vector<bool > finished;
554555
555556 // Cache logs for worker threads
556557 ssLOG_ENABLE_CACHE_OUTPUT_FOR_NEW_THREADS ();
@@ -590,38 +591,52 @@ bool runcpp2::SetupDependenciesIfNeeded(const runcpp2::Data::Profile& profile,
590591 )
591592 );
592593
594+ finished.emplace_back (false );
595+
593596 // Evaluate the setup results for each batch
594597 if (actions.size () >= maxThreads || i == availableDependencies.size () - 1 )
595598 {
596- std::chrono::system_clock::time_point deadline =
597- std::chrono::system_clock::now () + std::chrono::seconds (60 );
598- for (int j = 0 ; j < actions.size (); ++j)
599+ bool needsWaiting = false ;
600+ do
599601 {
600- if (!actions.at (j).valid ())
601- {
602- ssLOG_ERROR (" Failed to construct actions for setup" );
603- ssLOG_OUTPUT_ALL_CACHE_GROUPED ();
604- return false ;
605- }
606-
607- std::future_status actionStatus = actions.at (j).wait_until (deadline);
608- if (actionStatus == std::future_status::ready)
602+ std::chrono::system_clock::time_point deadline =
603+ std::chrono::system_clock::now () + std::chrono::seconds (30 );
604+ needsWaiting = false ;
605+ for (int j = 0 ; j < actions.size (); ++j)
609606 {
610- if (!actions.at (j).get ())
607+ if (finished.at (j))
608+ continue ;
609+
610+ if (!actions.at (j).valid ())
611611 {
612- ssLOG_ERROR (" Setup failed for dependencies " );
612+ ssLOG_ERROR (" Failed to construct actions for setup " );
613613 ssLOG_OUTPUT_ALL_CACHE_GROUPED ();
614614 return false ;
615615 }
616- }
617- else
618- {
619- ssLOG_ERROR (" Dependencies setup timeout" );
620- ssLOG_OUTPUT_ALL_CACHE_GROUPED ();
621- return false ;
616+
617+ std::future_status actionStatus = actions.at (j).wait_until (deadline);
618+ if (actionStatus == std::future_status::ready)
619+ {
620+ if (!actions.at (j).get ())
621+ {
622+ ssLOG_ERROR (" Setup failed for dependencies" );
623+ ssLOG_OUTPUT_ALL_CACHE_GROUPED ();
624+ return false ;
625+ }
626+ finished.at (j) = true ;
627+ }
628+ else
629+ {
630+ ssLOG_WARNING (" Manual interrupt might be needed" );
631+ ssLOG_WARNING (" Waited 30 seconds, dependencies setup still going..." );
632+ needsWaiting = true ;
633+ }
622634 }
623635 }
636+ while (needsWaiting);
637+
624638 actions.clear ();
639+ finished.clear ();
625640 }
626641 }
627642
@@ -642,6 +657,7 @@ bool runcpp2::BuildDependencies(const runcpp2::Data::Profile& profile,
642657 return true ;
643658
644659 std::vector<std::future<bool >> actions;
660+ std::vector<bool > finished;
645661
646662 // Cache logs for worker threads
647663 ssLOG_ENABLE_CACHE_OUTPUT_FOR_NEW_THREADS ();
@@ -674,38 +690,52 @@ bool runcpp2::BuildDependencies(const runcpp2::Data::Profile& profile,
674690 )
675691 );
676692
693+ finished.emplace_back (false );
694+
677695 // Evaluate the setup results for each batch
678696 if (actions.size () >= maxThreads || i == availableDependencies.size () - 1 )
679697 {
680- std::chrono::system_clock::time_point deadline =
681- std::chrono::system_clock::now () + std::chrono::seconds (60 );
682- for (int j = 0 ; j < actions.size (); ++j)
698+ bool needsWaiting = false ;
699+ do
683700 {
684- if (!actions.at (j).valid ())
685- {
686- ssLOG_ERROR (" Failed to construct actions for building dependencies" );
687- ssLOG_OUTPUT_ALL_CACHE_GROUPED ();
688- return false ;
689- }
690-
691- std::future_status actionStatus = actions.at (j).wait_until (deadline);
692- if (actionStatus == std::future_status::ready)
701+ std::chrono::system_clock::time_point deadline =
702+ std::chrono::system_clock::now () + std::chrono::seconds (30 );
703+ needsWaiting = false ;
704+ for (int j = 0 ; j < actions.size (); ++j)
693705 {
694- if (!actions.at (j).get ())
706+ if (finished.at (j))
707+ continue ;
708+
709+ if (!actions.at (j).valid ())
695710 {
696- ssLOG_ERROR (" Build failed for dependencies" );
711+ ssLOG_ERROR (" Failed to construct actions for building dependencies" );
697712 ssLOG_OUTPUT_ALL_CACHE_GROUPED ();
698713 return false ;
699714 }
700- }
701- else
702- {
703- ssLOG_ERROR (" Dependencies build timeout" );
704- ssLOG_OUTPUT_ALL_CACHE_GROUPED ();
705- return false ;
715+
716+ std::future_status actionStatus = actions.at (j).wait_until (deadline);
717+ if (actionStatus == std::future_status::ready)
718+ {
719+ if (!actions.at (j).get ())
720+ {
721+ ssLOG_ERROR (" Build failed for dependencies" );
722+ ssLOG_OUTPUT_ALL_CACHE_GROUPED ();
723+ return false ;
724+ }
725+ finished.at (j) = true ;
726+ }
727+ else
728+ {
729+ ssLOG_WARNING (" Manual interrupt might be needed" );
730+ ssLOG_WARNING (" Waited 30 seconds, dependencies build still going..." );
731+ needsWaiting = true ;
732+ }
706733 }
707734 }
735+ while (needsWaiting);
736+
708737 actions.clear ();
738+ finished.clear ();
709739 }
710740 }
711741
0 commit comments