summaryrefslogtreecommitdiff
path: root/internal/db/bundb/conversation.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db/bundb/conversation.go')
-rw-r--r--internal/db/bundb/conversation.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/db/bundb/conversation.go b/internal/db/bundb/conversation.go
index b86ec530c..5756dac59 100644
--- a/internal/db/bundb/conversation.go
+++ b/internal/db/bundb/conversation.go
@@ -187,8 +187,15 @@ func (c *conversationDB) getConversationsByLastStatusIDs(
accountID,
conversationLastStatusIDs,
func(accountID string, uncached []string) ([]*gtsmodel.Conversation, error) {
+ // Avoid querying
+ // if none uncached.
+ count := len(uncached)
+ if count == 0 {
+ return nil, nil
+ }
+
// Preallocate expected length of uncached conversations.
- conversations := make([]*gtsmodel.Conversation, 0, len(uncached))
+ conversations := make([]*gtsmodel.Conversation, 0, count)
// Perform database query scanning the remaining (uncached) IDs.
if err := c.db.NewSelect().