Skip to content

Invalidate comparison cache when licenses approved or blacklisted

Can Eldem requested to merge invalidate-lm-cache into master

What does this MR do?

The backend parsing introduces caching to the reports, which is great for performance, but unfortunately we don’t invalidate it when licences are approved or blacklisted which leads to a rather confusing UX. The licenses are being approved/blacklisted, but the change isn't reflected till the cache expires. With this change we will consider changes in SoftwareLicensePolicy to invalidate cache

approve_license

Solution

class CompareReportsBaseService
    # if this returns false cache is invalidated
    def latest?(base_pipeline, head_pipeline, data)
      data&.fetch(:key, nil) == key(base_pipeline, head_pipeline)
    end
end 

class CompareLicenseScanningReportsService < ::Ci::CompareReportsBaseService
  #overwrite key method and consider changes in license policy table so that if table changes key will change 
  def key
  end
end 

Screenshots

Does this MR meet the acceptance criteria?

When we hit end point refreshed changes to license policy reflected in Mr widget

image

Screen_Recording_2019-10-23_at_11.05.10

Conformity

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading