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
()
| 489 | // without blocking. An unbuffered channel would make a completed call hold its launch slot until |
| 490 | // the evaluator drained it, throttling effective concurrency to the drain rate. |
| 491 | func (p *prog) resolveCompletionBufferSize() int { |
| 492 | if p.asyncCompletionBufferSize > 0 { |
| 493 | return p.asyncCompletionBufferSize |
| 494 | } |
| 495 | limit := resolveAsyncMaxConcurrency(p.asyncMaxConcurrency) |
| 496 | if limit < 0 { |
| 497 | // Unlimited launches: fall back to the default bound for the buffer so it stays finite. |
| 498 | return defaultAsyncMaxConcurrency |
| 499 | } |
| 500 | return limit |
| 501 | } |
| 502 | |
| 503 | // ConcurrentEval implements the Program interface. |
| 504 | func (p *prog) ConcurrentEval(ctx context.Context, input any) <-chan EvalResult { |
no test coverage detected