seefan / gossdb

ssdb client for go with pool surport
MIT License
131 stars 47 forks source link

开启300个协程去读取操作, 会有一半的读取操作报错 #64

Closed EternalSuno closed 2 years ago

EternalSuno commented 2 years ago

错误信息 : Get 1:123 error 配置中只加了这两条 maxPoolSize = 500 GetClientTimeout = 200 代码如下 err := gossdb.Start(&conf.Config{ Host: 127.0.01, Port: 8888, MaxPoolSize: 500, GetClientTimeout: 200, }) if err != nil { fmt.Println("gossdb start err:", err) r.Response.WriteJsonExit(g.Map{ "ERROR": "SSDB_CONNECT_ERROR_1", }) } defer gossdb.Shutdown() c, err := gossdb.NewClient() if err != nil { fmt.Println("gossdb new client err:", err) r.Response.WriteJsonExit(g.Map{ "ERROR": "SSDB_CONNECT_ERROR_2", }) } defer c.Close() val, err := c.Get(key) if err != nil { fmt.Println("get config", err) r.Response.WriteJsonExit(g.Map{ "ERROR": "SSDB_CONNECT_ERROR_3", }) }

seefan commented 2 years ago

连接池应该在主线程实例化一次