GetRequestHandler retrieves a (possibly reused) [*aibridge.RequestBridge] from the pool, for the given user.
(ctx context.Context, req Request)
| 142 | |
| 143 | // GetRequestHandler retrieves a (possibly reused) [*aibridge.RequestBridge] from the pool, for the given user. |
| 144 | func (s *Server) GetRequestHandler(ctx context.Context, req Request) (http.Handler, error) { |
| 145 | if s.requestBridgePool == nil { |
| 146 | return nil, xerrors.New("nil requestBridgePool") |
| 147 | } |
| 148 | |
| 149 | reqBridge, err := s.requestBridgePool.Acquire(ctx, req, s.Client, NewMCPProxyFactory(s.logger, s.tracer, s.Client)) |
| 150 | if err != nil { |
| 151 | return nil, xerrors.Errorf("acquire request bridge: %w", err) |
| 152 | } |
| 153 | |
| 154 | return reqBridge, nil |
| 155 | } |
| 156 | |
| 157 | // isShutdown returns whether the Server is shutdown or not. |
| 158 | func (s *Server) isShutdown() bool { |
no test coverage detected