Closed dingyangfan closed 7 years ago
我在爬虫里试过,是可以的,请检查一下你的程序部分,协程是否都及时关闭了,看你给出的代码是没有问题。可以打印日志看一下。
也可以用下面的代码测试一下
package main
import (
"log"
"time"
"github.com/seefan/gossdb/ssdb"
)
func main() {
if err := ssdb.Start(); err != nil {
log.Printf("ssdb连接错误", err)
return
}
for i := 0; i < 10000; i++ {
c, err := ssdb.Client()
if err != nil {
log.Printf("error %s", err.Error())
break
}
c.Qpush_front("test", 1)
time.Sleep(time.Microsecond)
c.Close()
log.Println(i)
}
}
the problem is solved at the following merge, you can test it again. Merge pull request #23 from DavidGSX/master
ssdbPool, err = gossdb.NewPool(&gossdb.Config{ Host: ssdb_addr[0], Port: port, MinPoolSize: 5, MaxPoolSize: 200, AcquireIncrement: 5,
//导入代码部份 conn, err := ssdbPool.NewClient() if err != nil { log.Println("myg ssdb:", err.Error()) return } defer conn.Close() _, err = conn.Qpush_front("visit", testvisit)
是 不是写的有问题,不是的话,就有问题了,导致最后程序无法链接。