(ctx context.Context, file *ast.SourceFile)
| 121 | } |
| 122 | |
| 123 | func (p *checkerPool) GetChecker(ctx context.Context, file *ast.SourceFile) (*checker.Checker, func()) { |
| 124 | lifetime := core.GetCheckerLifetime(ctx) |
| 125 | requestID := core.GetRequestID(ctx) |
| 126 | |
| 127 | // Request affinity is cleaned up via context.AfterFunc when the request |
| 128 | // context is done. If the context can never be canceled (ctx.Done() == nil, |
| 129 | // e.g. context.Background()), that cleanup would never run and |
| 130 | // requestAssociations would grow unboundedly, so disable affinity entirely. |
| 131 | if ctx.Done() == nil { |
| 132 | requestID = "" |
| 133 | } |
| 134 | |
| 135 | switch lifetime { |
| 136 | case core.CheckerLifetimeDiagnostics: |
| 137 | return p.getDiagnosticsChecker(ctx, requestID) |
| 138 | case core.CheckerLifetimeAPI: |
| 139 | return p.getPersistentChecker() |
| 140 | default: |
| 141 | return p.getQueryChecker(ctx, requestID, file) |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | // tryReacquireForRequest checks whether the given request already has an |
| 146 | // associated checker. If so, it either returns the checker directly (still held) |
nothing calls this directly
no test coverage detected