2025-04-30 17:37:23
最近有个交接服务的数据库要升级版本,升级最后切换瞬间会有一个闪断。
这里业务侧需要确保有自动重连机制,否则会影响服务。
因为是交接的服务,得通过代码再确认一下。
2025-04-29 20:20:29
重现代码:
package main
import (
"fmt"
"io"
"net/http"
"time"
)
func main() {
client := &http.Client{
Timeout: time.Duration(3) * time.Second,
}
for i := 0; i < 100; i++ {
go func() {
for {
req, _ := http.NewRequest(http.MethodGet, "https://baidu.com", nil)
rsp, err := client.Do(req)
if err != nil {
fmt.Println("request failed", err)
continue
}
rsp.Body.Close()
body, err := io.ReadAll(rsp.Body)
if err != nil {
fmt.Println("read body failed", err)
continue
}
fmt.Println(string(body))
}
}()
}
select {}
}
启动后,随着请求越来越多,很快就出现了"cannot assign requested address"错误,服务器出现大量TIME_WAIT连接。
2025-04-06 22:47:37
自从买了登山杖,娃一直说想去爬山。
前段时间天气一直不好,山上也还是光秃秃的,就一直没去。
趁着清明假期,带娃爬山去。
去年假期去过一次香山,路上超堵,这次还是选择了离家不远的百望山:好爬不累。
2025-03-26 22:07:21
去年10月底,考虑到老的绿源电动车已经骑了5年,电池越来越不行,马上要冬天了,考虑换个新电动车。
到各个品牌店里转了一圈,发现都没有车子,说是新规的缘故,要到11月份才能有新车。
2025-03-16 17:28:10
Open-source GenBI AI Agent that empowers data-driven teams to chat with their data to generate Text-to-SQL, charts, spreadsheets, reports, and BI.
WrenAI 是一个开源的Text-SQL 的工具,通过导入数据库结构,通过提问的方式生成SQL。