mirror of
https://github.com/mautrix/whatsapp.git
synced 2026-11-12 00:59:17 -05:00
Compare commits
2 changed files with 0 additions and 21 deletions
|
|
@ -96,16 +96,6 @@ func (wa *WhatsAppClient) historySyncLoop(ctx context.Context) {
|
|||
}
|
||||
if resetTimer {
|
||||
timerPending.Store(true)
|
||||
wa.historySyncPortalLock.Lock()
|
||||
wa.historySyncPortalGen++
|
||||
if meta := wa.UserLogin.Metadata.(*waid.UserLoginMetadata); !meta.HistorySyncPortalsNeedCreating {
|
||||
meta.HistorySyncPortalsNeedCreating = true
|
||||
err := wa.UserLogin.Save(ctx)
|
||||
if err != nil {
|
||||
wa.UserLogin.Log.Err(err).Msg("Failed to save user login history sync portals need creating flag")
|
||||
}
|
||||
}
|
||||
wa.historySyncPortalLock.Unlock()
|
||||
}
|
||||
if timerPending.Load() {
|
||||
dispatchTimer.Reset(wa.Main.Config.HistorySync.DispatchWait)
|
||||
|
|
@ -427,9 +417,6 @@ func (wa *WhatsAppClient) createPortalsFromHistorySync(ctx context.Context) {
|
|||
}
|
||||
}()
|
||||
ctx = log.WithContext(ctx)
|
||||
wa.historySyncPortalLock.Lock()
|
||||
gen := wa.historySyncPortalGen
|
||||
wa.historySyncPortalLock.Unlock()
|
||||
limit := wa.Main.Config.HistorySync.MaxInitialConversations
|
||||
loginTS := wa.UserLogin.Metadata.(*waid.UserLoginMetadata).LoggedInAt
|
||||
conversations, err := wa.Main.DB.Conversation.GetRecent(ctx, wa.UserLogin.ID, limit, loginTS)
|
||||
|
|
@ -530,11 +517,6 @@ func (wa *WhatsAppClient) createPortalsFromHistorySync(ctx context.Context) {
|
|||
log.Info().Int("conversation_count", len(conversations)).Msg("Finished creating portals from history sync")
|
||||
go func() {
|
||||
wg.Wait()
|
||||
wa.historySyncPortalLock.Lock()
|
||||
defer wa.historySyncPortalLock.Unlock()
|
||||
if wa.historySyncPortalGen != gen {
|
||||
return
|
||||
}
|
||||
wa.UserLogin.Metadata.(*waid.UserLoginMetadata).HistorySyncPortalsNeedCreating = false
|
||||
err = wa.UserLogin.Save(ctx)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -128,9 +128,6 @@ type WhatsAppClient struct {
|
|||
lastPresence types.Presence
|
||||
blocklistLock sync.Mutex
|
||||
|
||||
historySyncPortalLock sync.Mutex
|
||||
historySyncPortalGen uint64
|
||||
|
||||
disableNewsletter bool
|
||||
|
||||
appStateRecoveryLock sync.Mutex
|
||||
|
|
|
|||
Loading…
Reference in a new issue