Quiet-timeout (ms) for a supervised worker: killed + reported as a hang if it * emits no NEW log line within the window. This is a NO-PROGRESS timeout — every * completed log line the worker tails (per-batch parallel.extract.progress every * 10 files, plus each pass boundary) resets it — NOT a total-time cap, so a large * repo that keeps making progress is never falsely killed. Default: 15 min
| 93 | * genuinely stuck file emits nothing, so this fires only on a real hang). The |
| 94 | * CBM_INDEX_WORKER_TIMEOUT_S override (seconds → ms) tightens it for tests. */ |
| 95 | static int worker_quiet_timeout_ms(void) { |
| 96 | enum { DEFAULT_QUIET_TIMEOUT_MS = 900000 }; /* 15 min with no progress */ |
| 97 | const char *e = getenv("CBM_INDEX_WORKER_TIMEOUT_S"); |
| 98 | if (e && e[0]) { |
| 99 | long s = atol(e); |
| 100 | if (s > 0) { |
| 101 | return (int)(s * 1000); |
| 102 | } |
| 103 | } |
| 104 | return DEFAULT_QUIET_TIMEOUT_MS; |
| 105 | } |
| 106 | |
| 107 | /* Read an entire file into a heap string (NUL-terminated). NULL on error. */ |
| 108 | static char *slurp_file(const char *path) { |
no outgoing calls
no test coverage detected