diff options
author | 2024-09-02 18:15:12 +0200 | |
---|---|---|
committer | 2024-09-02 18:15:12 +0200 | |
commit | 7b7659f1fa9d42410c4431caea2096c30169a718 (patch) | |
tree | 81effc23772f822ce3ad54ff63973ebc8cb46a2f /internal/db/bundb/conversation.go | |
parent | [chore] Don't try to select zero uncached filters (#3266) (diff) | |
download | gotosocial-7b7659f1fa9d42410c4431caea2096c30169a718.tar.xz |
[chore/performance] Further reduce nil uncached queries (#3267)
* [chore/performance] Further reduce nil uncached queries
* more checks
Diffstat (limited to 'internal/db/bundb/conversation.go')
-rw-r--r-- | internal/db/bundb/conversation.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/db/bundb/conversation.go b/internal/db/bundb/conversation.go index 5756dac59..d8245dc58 100644 --- a/internal/db/bundb/conversation.go +++ b/internal/db/bundb/conversation.go @@ -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)). |