Update Project Authorizations in background for group shares

What does this MR do and why?

This MR moves the refresh of project authorizations for updating group links into a background job.

References

Related to !183920 (merged) and !195367 (merged)

Screenshots or screen recordings

Bildschirmaufzeichnung_vom_27.07.2025__19_03_54

How to set up and validate locally

  1. Ensure you have Database Load Balancing enabled.
  2. Create a group (just for isolation purpose, you could also use an existing group in GDK)
  3. Create many members in the group. In my tests, I used about 1230 members. FactoryBot.create_list(:group_member, 1230, source: Group.find(<id>)) in the rails console can help you.
  4. Invite this group to another group. (Ensure you have the devtools network tab open, so you can get the correlation id)
  5. Copy the correlation id from the POST request that invited the group, add it to the performance bar and select it.
  6. Click on the count of the pg section from the performance bar, order chronologically, scroll down and notice many SELECT pg_wal_lsn_diff('0/296A3BF0', NULL) AS result and SELECT CASE WHEN pg_is_in_recovery() = true AND EXISTS (SELECT 1 FROM pg_stat_get_wal_senders()) THEN pg_last_wal_replay_lsn()::text WHEN pg_is_in_recovery() = false THEN pg_current_wal_insert_lsn()::text ELSE NULL END AS location; queries.
  7. Enable the :project_authorizations_update_in_background_for_group_shares feature flag (either globally or for the groups you are testing with)
  8. Repeat step 4, 5 and 6. Notice that the queries mentioned in step 6 aren't present so many times.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Niklas van Schrick

Merge request reports

Loading