()
| 263 | } |
| 264 | |
| 265 | func (pool *Pool) createNewConnection() (Connection, error) { |
| 266 | var connection Connection |
| 267 | var err error |
| 268 | |
| 269 | connection.conn, err = pool.connect() |
| 270 | if err != nil { |
| 271 | return Connection{}, errors.Errorf(`Could not connect to mysql: %s`, err) |
| 272 | } |
| 273 | connection.lastUseAt = pool.nowTs() |
| 274 | |
| 275 | pool.synchro.Lock() |
| 276 | pool.synchro.stats.CreatedCount++ |
| 277 | pool.synchro.Unlock() |
| 278 | |
| 279 | return connection, nil |
| 280 | } |
| 281 | |
| 282 | func (pool *Pool) getIdleConnectionUnsafe() Connection { |
| 283 | cnt := len(pool.synchro.idleConnections) |
no test coverage detected