commit
edc76b2503
|
@ -25,9 +25,9 @@ func (c *clientPool) setPool(nodeID uint64, p pool.Pool) {
|
|||
}
|
||||
|
||||
func (c *clientPool) getPool(nodeID uint64) (pool.Pool, bool) {
|
||||
c.mu.Lock()
|
||||
c.mu.RLock()
|
||||
p, ok := c.pool[nodeID]
|
||||
c.mu.Unlock()
|
||||
c.mu.RUnlock()
|
||||
return p, ok
|
||||
}
|
||||
|
||||
|
@ -42,9 +42,9 @@ func (c *clientPool) size() int {
|
|||
}
|
||||
|
||||
func (c *clientPool) conn(nodeID uint64) (net.Conn, error) {
|
||||
c.mu.Lock()
|
||||
c.mu.RLock()
|
||||
conn, err := c.pool[nodeID].Get()
|
||||
c.mu.Unlock()
|
||||
c.mu.RUnlock()
|
||||
return conn, err
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,9 @@ func (w *ShardWriter) WriteShard(shardID, ownerID uint64, points []tsdb.Point) e
|
|||
if !ok {
|
||||
panic("wrong connection type")
|
||||
}
|
||||
defer conn.Close() // return to pool
|
||||
defer func(conn net.Conn) {
|
||||
conn.Close() // return to pool
|
||||
}(conn)
|
||||
|
||||
// Build write request.
|
||||
var request WriteShardRequest
|
||||
|
|
|
@ -524,7 +524,7 @@ func (l *segment) advance() error {
|
|||
}
|
||||
|
||||
pos := l.pos + l.currentSize + 8
|
||||
if err := l.writeUint64(uint64(l.pos)); err != nil {
|
||||
if err := l.writeUint64(uint64(pos)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue