MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_spawn_backoff

Function cbm_spawn_backoff

src/foundation/subprocess.c:1354–1359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1352enum { CBM_SPAWN_BACKOFF_BASE_MS = 10, CBM_SPAWN_BACKOFF_MAX_SHIFT = 8 };
1353
1354static void cbm_spawn_backoff(int attempt) {
1355 int shift = attempt < CBM_SPAWN_BACKOFF_MAX_SHIFT ? attempt : CBM_SPAWN_BACKOFF_MAX_SHIFT;
1356 long ms = (long)CBM_SPAWN_BACKOFF_BASE_MS << shift;
1357 struct timespec delay = {ms / 1000L, (ms % 1000L) * 1000L * 1000L};
1358 (void)cbm_nanosleep_full(&delay);
1359}
1360
1361/* fork() fails with EAGAIN under the same pressure posix_spawn does, and the
1362 * fallback path must not be less robust than the primary one. */

Callers 2

cbm_fork_with_retryFunction · 0.85

Calls 1

cbm_nanosleep_fullFunction · 0.85

Tested by

no test coverage detected