| 1 | --- a/workers/worker_fork.c |
| 2 | +++ b/workers/worker_fork.c |
| 3 | @@ -396,7 +396,7 @@ static int worker_fork_process(void *in_ |
| 4 | worker_fork_update_children(ctx); |
| 5 | |
| 6 | child = NULL; |
| 7 | - for (i = 0; i < ctx->children_count; i++) { |
| 8 | + for (i = 0; i < ctx->children_count && i < ctx->max_children; i++) { |
| 9 | if (ctx->children[i]->busy == 0) { |
| 10 | child = ctx->children[i]; |
| 11 | break; |
| 12 | @@ -426,7 +426,8 @@ static int worker_fork_process(void *in_ |
| 13 | /* |
| 14 | * We have to fork off a new child. |
| 15 | */ |
| 16 | - if (ctx->children_count < ctx->max_children) |
| 17 | + if (ctx->children_count < ctx->max_children || |
| 18 | + (ruleset_flags(&ctx->settings->rules, uevent) & FLAG_SLOW)) |
| 19 | child = worker_fork_spawn(ctx); |
| 20 | |
| 21 | for (i = 0; i < uevent->env_vars_c; i++) { |
| 22 | |