resolveCompletionBufferSize returns the size of the async completion channel. When unset, it defaults to the effective launch concurrency so that all in-flight calls can report completion without blocking. An unbuffered channel would make a completed call hold its launch slot until the evaluator dra
()
| 472 | // without blocking. An unbuffered channel would make a completed call hold its launch slot until |
| 473 | // the evaluator drained it, throttling effective concurrency to the drain rate. |
| 474 | func (p *prog) resolveCompletionBufferSize() int { |
| 475 | if p.asyncCompletionBufferSize > 0 { |
| 476 | return p.asyncCompletionBufferSize |
| 477 | } |
| 478 | limit := resolveAsyncMaxConcurrency(p.asyncMaxConcurrency) |
| 479 | if limit < 0 { |
| 480 | // Unlimited launches: fall back to the default bound for the buffer so it stays finite. |
| 481 | return defaultAsyncMaxConcurrency |
| 482 | } |
| 483 | return limit |
| 484 | } |
| 485 | |
| 486 | // ConcurrentEval implements the Program interface. |
| 487 | func (p *prog) ConcurrentEval(ctx context.Context, input any) <-chan EvalResult { |
no test coverage detected