Skip to content

Remove expensive conditional for callout reset

Vijay Hawoldar requested to merge vij-remove-unnecessary-seat-usage-check into master

What does this MR do and why?

When resetting the seat usage alert, we don't need to check if the member was using a seat, we can avoid the expensive query and instead simply reset the callout regardless.

Removing this conditional will mean we will reset the callout for this banner.

The banner will be displayed when a customer:

  • Has BSO enabled
  • Is an owner
  • Has no available purchased seats left
  • Has already dismissed this banner
  • Then goes to remove a non-billable user, the banner will re-appear.

With this change, we will call ResetSeatCalloutsWorker for every membership being removed for a user in a group hierarchy.

That worker performs the following:

Users::GroupCallout.where(
        group: group,
        user_id: owner_ids,
        feature_name: feature_callouts
      ).delete_all

which performs very well according to postgres.ai:

Time: 3.190 ms  
  - planning: 0.790 ms  
  - execution: 2.400 ms  
    - I/O read: 2.280 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 

Refs #467281 (closed)

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.

Edited by Vijay Hawoldar

Merge request reports

Loading