From a571f12af15ec2eaee589ee843e9576626f30e70 Mon Sep 17 00:00:00 2001 From: Karmanyaah Malhotra Date: Tue, 2 Mar 2021 19:56:02 -0500 Subject: [PATCH] Parellel goroutine --- user.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/user.go b/user.go index 471e233..58c039f 100644 --- a/user.go +++ b/user.go @@ -593,11 +593,13 @@ func (user *User) syncPortals(chatMap map[string]groupme.Group, createAll bool) } create := (chat.LastMessageTime >= user.LastConnection && user.LastConnection > 0) || i < limit if len(chat.Portal.MXID) > 0 || create || createAll { - chat.Portal.Sync(user, chat.Group) - err := chat.Portal.BackfillHistory(user, chat.LastMessageTime) - if err != nil { - chat.Portal.log.Errorln("Error backfilling history:", err) - } + go func() { + chat.Portal.Sync(user, chat.Group) + err := chat.Portal.BackfillHistory(user, chat.LastMessageTime) + if err != nil { + chat.Portal.log.Errorln("Error backfilling history:", err) + } + }() } } //TODO: handle leave from groupme side