Default to backfilling all chats in history sync

This commit is contained in:
Tulir Asokan 2022-04-16 22:42:17 +03:00
parent 8e4995cd70
commit 6e976fb3fc
2 changed files with 7 additions and 2 deletions

View file

@ -174,7 +174,12 @@ func (hsc *HistorySyncConversation) Scan(row Scannable) *HistorySyncConversation
}
func (hsq *HistorySyncQuery) GetNMostRecentConversations(userID id.UserID, n int) (conversations []*HistorySyncConversation) {
rows, err := hsq.db.Query(getNMostRecentConversations, userID, n)
nPtr := &n
// Negative limit on SQLite means unlimited, but Postgres prefers a NULL limit.
if n < 0 && hsq.db.dialect == "postgres" {
nPtr = nil
}
rows, err := hsq.db.Query(getNMostRecentConversations, userID, nPtr)
defer rows.Close()
if err != nil || rows == nil {
return nil

View file

@ -137,7 +137,7 @@ bridge:
# Other conversations will be backfilled on demand when the start PM
# provisioning endpoint is used or when a message comes in from that
# chat.
max_initial_conversations: 10
max_initial_conversations: -1
# Settings for immediate backfills. These backfills should generally be
# small and their main purpose is to populate each of the initial chats
# (as configured by max_initial_conversations) with a few messages so