增加重连时的间隔时间

This commit is contained in:
lwch
2022-08-09 17:01:13 +08:00
parent 1e3bde75a4
commit 83743955d6

6
app.go
View File

@@ -60,9 +60,11 @@ func (app *app) start() {
go app.a.LoopWrite(app.ctx, app.chWrite)
go app.debug(app.ctx)
var nextSleep time.Duration
i := 0
nextSleep := time.Second
for {
if nextSleep > 0 {
i++
if i > 1 {
time.Sleep(nextSleep)
nextSleep <<= 1
if nextSleep > 30*time.Second {