2
0
Эх сурвалжийг харах

Added configuration for builder startup timeout

Signed-off-by: amzn-mike <[email protected]>
amzn-mike 3 жил өмнө
parent
commit
9b3ba992a0

+ 11 - 7
Code/Tools/AssetProcessor/native/utilities/BuilderManager.cpp

@@ -26,11 +26,6 @@ namespace AssetProcessor
     //! Time in milliseconds to wait after each message pump cycle
     //! Time in milliseconds to wait after each message pump cycle
     static const int s_IdleBuilderPumpingDelayMS = 100;
     static const int s_IdleBuilderPumpingDelayMS = 100;
 
 
-    //! Amount of time in seconds to wait for a builder to start up and connect
-    // sometimes, builders take a long time to start because of things like virus scanners scanning each
-    // builder DLL, so we give them a large margin.
-    static const int s_StartupConnectionWaitTimeS = 900;
-
     static const int s_MillisecondsInASecond = 1000;
     static const int s_MillisecondsInASecond = 1000;
 
 
     static const char* s_buildersFolderName = "Builders";
     static const char* s_buildersFolderName = "Builders";
@@ -42,6 +37,15 @@ namespace AssetProcessor
 
 
     bool Builder::WaitForConnection()
     bool Builder::WaitForConnection()
     {
     {
+        if (m_startupWaitTimeS == 0)
+        {
+            const auto* settingsRegistry = AZ::SettingsRegistry::Get();
+            if (settingsRegistry)
+            {
+                settingsRegistry->Get(m_startupWaitTimeS, "/Amazon/AssetProcessor/Settings/BuilderManager/StartupTimeoutSeconds");
+            }
+        }
+
         if (m_connectionId == 0)
         if (m_connectionId == 0)
         {
         {
             bool result = false;
             bool result = false;
@@ -55,7 +59,7 @@ namespace AssetProcessor
 
 
                 PumpCommunicator();
                 PumpCommunicator();
 
 
-                if (ticker.elapsed() > s_StartupConnectionWaitTimeS * s_MillisecondsInASecond
+                if (ticker.elapsed() > m_startupWaitTimeS * s_MillisecondsInASecond
                     || m_quitListener.WasQuitRequested()
                     || m_quitListener.WasQuitRequested()
                     || !IsRunning())
                     || !IsRunning())
                 {
                 {
@@ -83,7 +87,7 @@ namespace AssetProcessor
             }
             }
             else
             else
             {
             {
-                AZ_Error("Builder", false, "AssetBuilder failed to connect within %d seconds", s_StartupConnectionWaitTimeS);
+                AZ_Error("Builder", false, "AssetBuilder failed to connect within %d seconds", m_startupWaitTimeS);
             }
             }
 
 
             return false;
             return false;

+ 4 - 1
Code/Tools/AssetProcessor/native/utilities/BuilderManager.h

@@ -134,6 +134,9 @@ namespace AssetProcessor
         AZStd::unique_ptr<ProcessCommunicatorTracePrinter> m_tracePrinter = nullptr;
         AZStd::unique_ptr<ProcessCommunicatorTracePrinter> m_tracePrinter = nullptr;
 
 
         const AssetUtilities::QuitListener& m_quitListener;
         const AssetUtilities::QuitListener& m_quitListener;
+
+        //! Time to wait in seconds for a builder to startup before timing out.
+        AZ::s64 m_startupWaitTimeS = 0;
     };
     };
 
 
     //! Scoped reference to a builder. Destructor returns the builder to the free builders pool
     //! Scoped reference to a builder. Destructor returns the builder to the free builders pool
@@ -154,7 +157,7 @@ namespace AssetProcessor
         const Builder* operator->() const;
         const Builder* operator->() const;
 
 
         explicit operator bool() const;
         explicit operator bool() const;
-    
+
         void release();
         void release();
 
 
     private:
     private:

+ 4 - 0
Registry/AssetProcessorPlatformConfig.setreg

@@ -34,6 +34,10 @@
                     // individual job took.
                     // individual job took.
                     "MaxIndividualStats" : 4
                     "MaxIndividualStats" : 4
                 },
                 },
+                "BuilderManager": {
+                    // Number of seconds to wait for AssetBuilder process to start before terminating the process
+                    "StartupTimeoutSeconds" : 900
+                },
                 "Platform pc": {
                 "Platform pc": {
                     "tags": "tools,renderer,dx12,vulkan,null"
                     "tags": "tools,renderer,dx12,vulkan,null"
                 },
                 },