Skip to content

Commit

Permalink
Merge pull request #70 from yogipatel/fix-pool-cleanup
Browse files Browse the repository at this point in the history
Fix pool cleanup
  • Loading branch information
ianic authored Sep 3, 2018
2 parents 82c5bfb + 997aa4f commit 1da6daf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##gofreetds
## gofreetds

Go [FreeTDS](http://www.freetds.org/) wrapper. Native Sql Server database driver.

Expand All @@ -11,9 +11,9 @@ Features:
* connection pooling
* scaning resultsets into structs

##Get started
## Get started

###Install dependencines
### Install dependencines

[FreeTDS](http://www.freetds.org/) libraries must be installed on the system.

Expand Down
12 changes: 7 additions & 5 deletions conn_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ func NewConnPool(connStr string) (*ConnPool, error) {
p.poolGuard = make(chan bool, p.maxConn)
p.addToPool(conn)
go func() {
select {
case <-p.cleanupTicker.C:
p.cleanup()
case <-p.done:
return
for {
select {
case <-p.cleanupTicker.C:
p.cleanup()
case <-p.done:
return
}
}
}()
return p, nil
Expand Down

0 comments on commit 1da6daf

Please sign in to comment.