|
@ -4,6 +4,7 @@ import ( |
|
|
"net/http" |
|
|
"net/http" |
|
|
"strings" |
|
|
"strings" |
|
|
"sync" |
|
|
"sync" |
|
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
log "github.com/Sirupsen/logrus" |
|
|
log "github.com/Sirupsen/logrus" |
|
|
"github.com/matrix-org/go-neb/api" |
|
|
"github.com/matrix-org/go-neb/api" |
|
@ -350,7 +351,17 @@ func (c *Clients) newClient(config api.ClientConfig) (*gomatrix.Client, error) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if config.Sync { |
|
|
if config.Sync { |
|
|
go client.Sync() |
|
|
|
|
|
|
|
|
go func() { |
|
|
|
|
|
for { |
|
|
|
|
|
if e := client.Sync(); e != nil { |
|
|
|
|
|
log.WithFields(log.Fields{ |
|
|
|
|
|
log.ErrorKey: e, |
|
|
|
|
|
"user_id": config.UserID, |
|
|
|
|
|
}).Error("Fatal Sync() error") |
|
|
|
|
|
time.Sleep(10 * time.Second) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return client, nil |
|
|
return client, nil |
|
|