openGemini / opengemini-client-go

CNCF openGemini Go Client Library
https://opengemini.org/
Apache License 2.0
24 stars 17 forks source link

fix: a panic error occurs in the func WritePoint when dbserver has been down #79 #81

Closed njbestway closed 5 months ago

njbestway commented 5 months ago

This PR is to fix 2 problems:

  1. It will panic in the func WritePoint when All DBServers are Down. The resp maybe nil when any Err ocurrs.
  2. It should check whether the callback func is nil or not indeed. Just making func call using the callback directly doesn't seem friendly.It proves to be slightly confusing.
shoothzj commented 5 months ago

I changed it to return nil and merged this PR because the previous code decided to handle this error in the callback. I think it's quite clear that anyone who doesn't pass a callback will miss the error. The callback should be passed in production. Feel free to open an issue or continue in #79 to discuss it

njbestway commented 5 months ago

I changed it to return nil and merged this PR because the previous code decided to handle this error in the callback. I think it's quite clear that anyone who doesn't pass a callback will miss the error. The callback should be passed in production. Feel free to open an issue or continue in #79 to discuss it

Agree! Nobody wants to dealwith both the err func Passed and the err Returned.