summaryrefslogtreecommitdiff
path: root/changelogs
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-06-07 12:14:27 +0100
committerSean McGivern <sean@gitlab.com>2018-06-07 12:37:57 +0100
commit0206476ae2a2d659fd0fb42338050253a9a91439 (patch)
treeb3fa79ce632f03185652b2a5801e08cef9e24893 /changelogs
parent95b3e51f117167d48ba04f2dcef6922aff885617 (diff)
downloadgitlab-ce-0206476ae2a2d659fd0fb42338050253a9a91439.tar.gz
Fix some N+1s when calculating notification recipients
First N+1: we may have loaded a user's notification settings already, but not have loaded their sources. Because we're iterating through, we'd potentially load sources that are completely unrelated, just because they belong to this user. Second N+1: we do a separate query for each user who could be subscribed to or unsubcribed from the target. It's actually more efficient in this case to get all subscriptions at once, as we will need to check most of them. We can fix both by the slightly unpleasant means of checking IDs manually, rather than object equality.
Diffstat (limited to 'changelogs')
-rw-r--r--changelogs/unreleased/n-plus-one-notification-recipients.yml5
1 files changed, 5 insertions, 0 deletions
diff --git a/changelogs/unreleased/n-plus-one-notification-recipients.yml b/changelogs/unreleased/n-plus-one-notification-recipients.yml
new file mode 100644
index 00000000000..91c31e4c930
--- /dev/null
+++ b/changelogs/unreleased/n-plus-one-notification-recipients.yml
@@ -0,0 +1,5 @@
+---
+title: Fix some sources of excessive query counts when calculating notification recipients
+merge_request:
+author:
+type: performance