Ceiling for a caller-requested node budget. CBM_UI_MAX_RENDER_NODES lowers * (or raises, up to HARD_MAX_NODES) the ceiling for constrained deployments; * without it the full hard ceiling is available to explicit requests. */
| 177 | * (or raises, up to HARD_MAX_NODES) the ceiling for constrained deployments; |
| 178 | * without it the full hard ceiling is available to explicit requests. */ |
| 179 | static int render_node_limit(void) { |
| 180 | const char *raw = getenv("CBM_UI_MAX_RENDER_NODES"); |
| 181 | if (!raw || !raw[0]) { |
| 182 | return HARD_MAX_NODES; |
| 183 | } |
| 184 | errno = 0; |
| 185 | char *end = NULL; |
| 186 | long v = strtol(raw, &end, 10); |
| 187 | if (errno != 0 || end == raw || *end != '\0' || v <= 0) { |
| 188 | return HARD_MAX_NODES; |
| 189 | } |
| 190 | if (v > HARD_MAX_NODES) { |
| 191 | return HARD_MAX_NODES; |
| 192 | } |
| 193 | return (int)v; |
| 194 | } |
| 195 | |
| 196 | /* The default is a default, not a ceiling: an explicit request is honored up |
| 197 | * to the (env-adjustable) ceiling; only a missing/invalid request falls back |