Increase ping timeout to 30 seconds

This commit is contained in:
Tulir Asokan 2023-08-08 19:05:08 +03:00
parent b30d1fe7f8
commit f9d004a09d

View file

@ -20,6 +20,8 @@ import (
"go.mau.fi/mautrix-gmessages/libgm/util" "go.mau.fi/mautrix-gmessages/libgm/util"
) )
const phoneNotRespondingTimeout = 30 * time.Second
func (c *Client) doDittoPinger(log *zerolog.Logger, dittoPing chan struct{}, stopPinger chan struct{}) { func (c *Client) doDittoPinger(log *zerolog.Logger, dittoPing chan struct{}, stopPinger chan struct{}) {
notResponding := false notResponding := false
exit := false exit := false
@ -40,7 +42,7 @@ func (c *Client) doDittoPinger(log *zerolog.Logger, dittoPing chan struct{}, sto
case <-pingChan: case <-pingChan:
onRespond() onRespond()
return return
case <-time.After(15 * time.Second): case <-time.After(phoneNotRespondingTimeout):
log.Warn().Msg("Ditto ping is taking long, phone may be offline") log.Warn().Msg("Ditto ping is taking long, phone may be offline")
c.triggerEvent(&events.PhoneNotResponding{}) c.triggerEvent(&events.PhoneNotResponding{})
notResponding = true notResponding = true