Procházet zdrojové kódy

Default to backfilling all chats in history sync

Tulir Asokan před 3 roky
rodič
revize
6e976fb3fc
2 změnil soubory, kde provedl 7 přidání a 2 odebrání
  1. 6 1
      database/historysync.go
  2. 1 1
      example-config.yaml

+ 6 - 1
database/historysync.go

@@ -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

+ 1 - 1
example-config.yaml

@@ -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