mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-11-12 13:01:45 +01:00
Always wait for offline sync to finish before sending connected state
This commit is contained in:
parent
b389354bcc
commit
be68203056
1 changed files with 4 additions and 3 deletions
5
user.go
5
user.go
|
@ -545,7 +545,6 @@ func (user *User) HandleEvent(event interface{}) {
|
||||||
user.bridge.Metrics.TrackConnectionState(user.JID, false)
|
user.bridge.Metrics.TrackConnectionState(user.JID, false)
|
||||||
user.bridge.Metrics.TrackLoginState(user.JID, false)
|
user.bridge.Metrics.TrackLoginState(user.JID, false)
|
||||||
case *events.Connected:
|
case *events.Connected:
|
||||||
go user.sendBridgeState(BridgeState{StateEvent: StateConnected})
|
|
||||||
user.bridge.Metrics.TrackConnectionState(user.JID, true)
|
user.bridge.Metrics.TrackConnectionState(user.JID, true)
|
||||||
user.bridge.Metrics.TrackLoginState(user.JID, true)
|
user.bridge.Metrics.TrackLoginState(user.JID, true)
|
||||||
if len(user.Client.Store.PushName) > 0 {
|
if len(user.Client.Store.PushName) > 0 {
|
||||||
|
@ -567,8 +566,10 @@ func (user *User) HandleEvent(event interface{}) {
|
||||||
if !user.PhoneRecentlySeen(true) {
|
if !user.PhoneRecentlySeen(true) {
|
||||||
user.log.Infofln("Offline sync completed, but phone last seen date is still %s - sending phone offline bridge status", user.PhoneLastSeen)
|
user.log.Infofln("Offline sync completed, but phone last seen date is still %s - sending phone offline bridge status", user.PhoneLastSeen)
|
||||||
go user.sendBridgeState(BridgeState{StateEvent: StateTransientDisconnect, Error: WAPhoneOffline})
|
go user.sendBridgeState(BridgeState{StateEvent: StateTransientDisconnect, Error: WAPhoneOffline})
|
||||||
} else if user.GetPrevBridgeState().StateEvent == StateBackfilling {
|
} else {
|
||||||
|
if user.GetPrevBridgeState().StateEvent == StateBackfilling {
|
||||||
user.log.Infoln("Offline sync completed")
|
user.log.Infoln("Offline sync completed")
|
||||||
|
}
|
||||||
go user.sendBridgeState(BridgeState{StateEvent: StateConnected})
|
go user.sendBridgeState(BridgeState{StateEvent: StateConnected})
|
||||||
}
|
}
|
||||||
case *events.AppStateSyncComplete:
|
case *events.AppStateSyncComplete:
|
||||||
|
|
Loading…
Reference in a new issue