Closed EternalSuno closed 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", }) }
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()
fmt.Println("gossdb new client err:", err)
"ERROR": "SSDB_CONNECT_ERROR_2",
defer c.Close()
val, err := c.Get(key)
fmt.Println("get config", err)
"ERROR": "SSDB_CONNECT_ERROR_3",
连接池应该在主线程实例化一次
错误信息 : 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",
})
}