Skip to content

Update all seats used alert callout dismissal frequency

What does this MR do and why?

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/441795. This MR is adding a worker that will run whenever the seats info are updated for the Subscription. This will cause the Callout to being displayed again.

DB

Raw query:

DELETE FROM "user_group_callouts"
WHERE "user_group_callouts"."group_id" = 35
    AND "user_group_callouts"."user_id" = 1
    AND "user_group_callouts"."feature_name" = 24

Query plan

ModifyTable on public.user_group_callouts  (cost=0.42..3.44 rows=0 width=0) (actual time=2.188..2.189 rows=0 loops=1)
   Buffers: shared hit=6 read=3
   I/O Timings: read=2.120 write=0.000
   ->  Index Scan using index_group_user_callouts_feature on public.user_group_callouts  (cost=0.42..3.44 rows=1 width=6) (actual time=2.186..2.187 rows=0 loops=1)
         Index Cond: ((user_group_callouts.user_id = 1) AND (user_group_callouts.feature_name = 24) AND (user_group_callouts.group_id = 35))
         Buffers: shared hit=6 read=3
         I/O Timings: read=2.120 write=0.000

Summary:

Time: 3.501 ms  
  - planning: 1.252 ms  
  - execution: 2.249 ms  
    - I/O read: 2.120 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 6 (~48.00 KiB) from the buffer pool  
  - reads: 3 (~24.00 KiB) from the OS file cache, including disk I/O  
  - dirtied: 0  
  - writes: 0

MR acceptance checklist

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

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. In rails console enable the experiment fully

    Feature.enable(:block_seat_overages)
  2. Have a group w/ a subscription plan and X users

  3. Make sure all seats are occupied

  4. Visit any group or project member pages such as http://127.0.0.1:3000/groups/flightjs/-/group_members

  5. The banner should display

  6. Close the banner

  7. In rails console enable the experiment fully

    GitlabSubscription.find_by(namespace: <your-namespace-id>).update(seats: <current-seats-plus-n>)
  8. Add enough members to match the current purchased seats

  9. The banner should display again

Note that because this uses reactive caching, the banners may not load on the initial page load, and you need to make sure that your rails background jobs are working locally.

Edited by Angelo Gulina

Merge request reports