questdb / go-questdb-client

Golang client for QuestDB's Influx Line Protocol
Apache License 2.0
47 stars 9 forks source link

feat: auto re-connect #18

Closed ttys3 closed 8 months ago

ttys3 commented 1 year ago

currently if the tcp conn somehow get lost or broken pipe, it will not auto reconnect.

resolve https://github.com/questdb/go-questdb-client/issues/9

now the client is able to re-connect when the network is recovered:

2023/06/28 12:05:58 main.go:42: Flush message success
2023/06/28 12:05:59 main.go:42: Flush message success
2023/06/28 12:05:59 main.go:42: Flush message success
2023/06/28 12:06:00 main.go:42: Flush message success
2023/06/28 12:06:00 main.go:42: Flush message success
2023/06/28 12:06:01 main.go:40: error Flush message: prev err: write tcp 127.0.0.1:37420->127.0.0.1:9009: write: broken pipe, failed to reconnect: dial tcp 127.0.0.1:9009: connect: connection refused
2023/06/28 12:06:01 main.go:40: error Flush message: prev err: write tcp 127.0.0.1:37420->127.0.0.1:9009: write: broken pipe, failed to reconnect: dial tcp 127.0.0.1:9009: connect: connection refused
2023/06/28 12:06:02 main.go:40: error Flush message: prev err: write tcp 127.0.0.1:37420->127.0.0.1:9009: write: broken pipe, failed to reconnect: dial tcp 127.0.0.1:9009: connect: connection refused
2023/06/28 12:06:02 main.go:40: error Flush message: write tcp 127.0.0.1:37420->127.0.0.1:9009: write: broken pipe
2023/06/28 12:06:03 main.go:42: Flush message success
2023/06/28 12:06:03 main.go:42: Flush message success
2023/06/28 12:06:04 main.go:42: Flush message success
2023/06/28 12:06:04 main.go:42: Flush message success
2023/06/28 12:06:05 main.go:42: Flush message success
2023/06/28 12:06:05 main.go:42: Flush message success
2023/06/28 12:06:06 main.go:42: Flush message success
2023/06/28 12:06:06 main.go:42: Flush message success
puzpuzpuz commented 8 months ago

Closing this one as v3.0 ships new HTTP sender which has auto retry logic. The sender also reuses connections.