duyingsoft

Results 2 comments of duyingsoft

但是我defer是能捕获到panic,理论上,应该也是能defer unlock的吧@huskar-t (1) log_repository_test.go是我的测试代码,这是捕获到panic信息,你可以看一下 ``` Fail to InsertLog, error:interface conversion: driver.Value is types.TaosNchar, not types.TaosBinary log_repository_test.go:142 (0x7ff603648e49) C:/Program Files/Go/src/runtime/panic.go:1038 (0x7ff6034f9994) C:/Program Files/Go/src/runtime/iface.go:261 (0x7ff6034cbd54) /go/pkg/mod/github.com/taosdata/driver-go/[email protected]/wrapper/stmt.go:513 (0x7ff603643e5d) /go/pkg/mod/github.com/taosdata/driver-go/[email protected]/af/insertstmt/stmt.go:95 (0x7ff60364621c) /log_repository_test.go:172 (0x7ff603648a0a) /log_repository_test.go:134...

因为你这个锁是全局的,如果某个新增的功能不小心写错了,很容易导致程序卡死,导致其他功能写入tdengine也阻塞住,影响比较大。 建议是不是尽量defer释放锁,控制影响范围