[chore/performance] Further reduce nil uncached queries (#3267)

* [chore/performance] Further reduce nil uncached queries

* more checks
This commit is contained in:
tobi 2024-09-02 18:15:12 +02:00 committed by GitHub
commit 7b7659f1fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 62 additions and 13 deletions

View file

@ -313,7 +313,14 @@ func (c *conversationDB) DeleteConversationsByOwnerAccountID(ctx context.Context
return gtserror.Newf("error deleting conversations for account %s: %w", accountID, err)
}
// Delete any conversation-to-status links matching the deleted conversation IDs.
if len(deletedConversationIDs) == 0 {
// Nothing
// to delete.
return nil
}
// Delete any conversation-to-status links
// matching the deleted conversation IDs.
if _, err := tx.NewDelete().
Model((*gtsmodel.ConversationToStatus)(nil)).
Where("? IN (?)", bun.Ident("conversation_id"), bun.In(deletedConversationIDs)).