initConnsMap initializes the connection registry map. This is a separate method to work around cases where a local variable named "clientConn" shadows the type name (e.g., in worker.go).
()
| 735 | // ActiveConnections returns the number of active connections |
| 736 | func (s *Server) ActiveConnections() int64 { |
| 737 | return atomic.LoadInt64(&s.activeConns) |
| 738 | } |
| 739 | |
| 740 | // RegisterQuery registers a cancel function for a backend key. |
| 741 | // This allows the query to be cancelled via a cancel request from another connection. |
| 742 | func (s *Server) RegisterQuery(key BackendKey, cancel context.CancelFunc) { |
| 743 | s.activeQueriesMu.Lock() |
| 744 | // Lazily initialized: production servers get the map from New, but test |
| 745 | // fixtures (and InitMinimalServer paths) may construct a bare Server. |