Make contact wait delay configurable and fix nil pointer usage

This commit is contained in:
Tulir Asokan
2019-05-30 20:25:04 +03:00
parent 02f78155b5
commit 37cd34e4bf
4 changed files with 10 additions and 4 deletions

View File

@ -296,10 +296,11 @@ func (user *User) PostLogin() {
}
func (user *User) intPostLogin() {
user.log.Debugln("Waiting a second for contacts to arrive")
dur := time.Duration(user.bridge.Config.Bridge.ContactWaitDelay) * time.Second
user.log.Debugfln("Waiting %s for contacts to arrive", dur)
// Hacky way to wait for chats and contacts to arrive automatically
time.Sleep(1 * time.Second)
user.log.Debugln("Waited a second, have", len(user.Conn.Store.Chats), "chats and", len(user.Conn.Store.Contacts), "contacts")
time.Sleep(dur)
user.log.Debugfln("Waited %s, have %d chats and %d contacts", dur, len(user.Conn.Store.Chats), len(user.Conn.Store.Contacts))
go user.syncPuppets()
user.syncPortals(false)