Sleep before reconnecting after pair success
This commit is contained in:
parent
2b1f046e75
commit
8fcb4283a9
2 changed files with 7 additions and 2 deletions
|
@ -90,10 +90,10 @@ metrics:
|
|||
|
||||
google_messages:
|
||||
# OS name to tell the phone. This is the name that shows up in the paired devices list.
|
||||
os: Android (mautrix)
|
||||
os: mautrix-gmessages
|
||||
# Browser type to tell the phone. This decides which icon is shown.
|
||||
# Valid types: OTHER, CHROME, FIREFOX, SAFARI, OPERA, IE, EDGE
|
||||
browser: CHROME
|
||||
browser: OTHER
|
||||
# Device type to tell the phone. This also affects the icon, as well as how many sessions are allowed simultaneously.
|
||||
# One web, two tablets and one PWA should be able to connect at the same time.
|
||||
# Valid types: WEB, TABLET, PWA
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
@ -60,6 +61,10 @@ func (c *Client) completePairing(data *gmproto.PairedData) {
|
|||
c.triggerEvent(&events.PairSuccessful{PairedData: data})
|
||||
|
||||
go func() {
|
||||
// Sleep for a bit to let the phone save the pair data. If we reconnect too quickly,
|
||||
// the phone won't recognize the session the bridge will get unpaired.
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
err := c.Reconnect()
|
||||
if err != nil {
|
||||
c.triggerEvent(&events.ListenFatalError{Error: fmt.Errorf("failed to reconnect after pair success: %w", err)})
|
||||
|
|
Loading…
Reference in a new issue