Skip to content

Commit d03056e

Browse files
authored
Merge pull request #5 from memcachier/bug/tick
Replace leaking ticker with simple timeout
2 parents 445f9d5 + e234e00 commit d03056e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func newServer(address, username, password string, config *Config, newMcConn con
4444
func (s *server) perform(m *msg) error {
4545
var err error
4646
for i := 0; ; {
47-
timeout := time.Tick(s.config.ConnectionTimeout)
47+
timeout := time.After(s.config.ConnectionTimeout)
4848
select {
4949
case c := <-s.pool:
5050
// NOTE: this serverConn is no longer available in the pool (equivalent to locking)
@@ -89,7 +89,7 @@ func (s *server) perform(m *msg) error {
8989
}
9090

9191
func (s *server) performStats(m *msg) (mcStats, error) {
92-
timeout := time.Tick(s.config.ConnectionTimeout)
92+
timeout := time.After(s.config.ConnectionTimeout)
9393
select {
9494
case c := <-s.pool:
9595
// NOTE: this serverConn is no longer available in the pool (equivalent to locking)

0 commit comments

Comments
 (0)