Daemon startup budget, overridable for loaded hosts: a fixed 30 s races * whatever else the machine is doing (parallel test waves, CI legs), and a * cold daemon on a starved host loses through no fault of its own. * CBM_STARTUP_TIMEOUT_MS, clamped to [1s, 10min]; malformed -> default. */
| 85 | * cold daemon on a starved host loses through no fault of its own. |
| 86 | * CBM_STARTUP_TIMEOUT_MS, clamped to [1s, 10min]; malformed -> default. */ |
| 87 | static uint32_t main_startup_timeout_ms(void) { |
| 88 | const char *raw = cbm_runtime_getenv("CBM_STARTUP_TIMEOUT_MS"); |
| 89 | if (!raw || !raw[0]) |
| 90 | return MAIN_MCP_STARTUP_TIMEOUT_MS; |
| 91 | char *end = NULL; |
| 92 | long value = strtol(raw, &end, 10); |
| 93 | if (!end || *end != '\0' || value <= 0) |
| 94 | return MAIN_MCP_STARTUP_TIMEOUT_MS; |
| 95 | if (value < MAIN_STARTUP_TIMEOUT_MIN_MS) |
| 96 | return MAIN_STARTUP_TIMEOUT_MIN_MS; |
| 97 | if (value > MAIN_STARTUP_TIMEOUT_MAX_MS) |
| 98 | return MAIN_STARTUP_TIMEOUT_MAX_MS; |
| 99 | return (uint32_t)value; |
| 100 | } |
| 101 | #define SLEN(s) (sizeof(s) - 1) |
| 102 | #include "foundation/log.h" |
| 103 | #include "foundation/diagnostics.h" |
no test coverage detected