[go: up one dir, main page]

Skip to content

Memoize has_active_hooks? on Groups

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

In !197320 (merged), has_active_hooks? was defined on the Group model to be used similar to Project#has_active_hooks?. Group#has_active_hooks? queries the database for active group hooks with the provided scope, but webhook events have heavy traffic, and it'd be best to memoize the results of this query per instance of group to minimize the number of times a request needs to be made:

  • @SamWord started a discussion: (+1 comment)

    Thought (non-blocking): Since webhooks have a lot of use in GitLab, I wonder if this should be memoized to reduce the number of times .where is called. It helps that a licenced feature is checked first and since this didn't already exist, the only places calling this on a group should be the code introduced in this MR. However, I'm mildly concerned this could become a problem in the future, and I wonder if an implementation similar to has_active_hooks? on projects could be useful.

    Since this MR is already quite large, I think it can be handled in a follow-up

Edited by 🤖 GitLab Bot 🤖