resolveContext returns the middleware's stored fiber context if available, otherwise returns context.Background(). fiber.Ctx implements context.Context directly, so no allocation is needed.
()
| 194 | // otherwise returns context.Background(). |
| 195 | // fiber.Ctx implements context.Context directly, so no allocation is needed. |
| 196 | func (m *Middleware) resolveContext() context.Context { |
| 197 | if m.ctx != nil { |
| 198 | return m.ctx |
| 199 | } |
| 200 | return context.Background() |
| 201 | } |
| 202 | |
| 203 | // acquireMiddleware retrieves a middleware instance from the pool. |
| 204 | func acquireMiddleware() *Middleware { |
no outgoing calls