1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-07-03 21:03:25 +00:00

fix: when the reconnect-interval of ws-reverse is set to 0, push event will panic if has connection error

This commit is contained in:
Mrs4s
2023-01-11 06:05:38 +08:00
parent 4cddc5051f
commit 960f7ab79b

View File

@ -191,9 +191,13 @@ func runWSClient(b *coolq.CQBot, node yaml.Node) {
filter: conf.Filter, filter: conf.Filter,
} }
filter.Add(c.filter) filter.Add(c.filter)
if conf.ReconnectInterval != 0 { if conf.ReconnectInterval != 0 {
c.reconnectInterval = time.Duration(conf.ReconnectInterval) * time.Millisecond c.reconnectInterval = time.Duration(conf.ReconnectInterval) * time.Millisecond
} else {
c.reconnectInterval = time.Second * 5
} }
if conf.RateLimit.Enabled { if conf.RateLimit.Enabled {
c.limiter = rateLimit(conf.RateLimit.Frequency, conf.RateLimit.Bucket) c.limiter = rateLimit(conf.RateLimit.Frequency, conf.RateLimit.Bucket)
} }