GraphQL: Remove n+1 queries for issuable participants
What does this MR do and why?
When querying participants of an issuable (issue, epic or MR) the request can take a long time if there is a large number of participables (i.e notes and emojis).
This is partially due to checking permissions for each participable. When looking at the permissions needed for each resource we can see it could be simplified by checking permissions against the issuable instead.
This MR only changes the way we check permissions for each source in Participable#raw_participants
if the participable is an Issue, Merge Request or Epic. The concern's functionality remains the same.
Additionally, adds more fields to preload in the issuable resolver to reduce the number of N+1s queries and fixes the permissions name for AwardEmoji
which was excluding them from the participants' list.
See !98116 (comment 1117560308) for further details.
View queries log
MR participants query
query getMRParticipants {
project(fullPath: "gitlab-org/gitlab-test") {
mergeRequest(iid: "7") {
participants {
nodes {
name
status {
availability
}
}
}
}
}
}
Issue participants query
query getIssueParticipants {
project(fullPath: "gitlab-org/gitlab-test") {
issue(iid: "1032") {
participants {
nodes {
name
}
}
}
}
}
Epic participants query
query getEpicParticipants {
group(fullPath: "gitlab-org") {
epic(iid: "971") {
participants {
nodes {
name
}
}
}
}
}
Before | After |
---|---|
MR query log | MR query log |
Issue query log | Issue query log |
Epic query log | Epic query log |
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #362944 (closed)