Skip to content

Invalidate Pages API internal cache with Projects::ProjectDeletedEvent

What does this MR do and why?

Context

For GET /api/internal/pages?host=HOST. This is the API endpoint that gets called by GitLab pages when a request comes in and we haven't cached in gitlab-pages what needs to be served for this.

Given that the satisfiedThreshold for writing headers for a response is 0.5s, ideally, this would be even faster than the threshold set for web-pages. We think 0.5s for serving a static page is an acceptable target.

Since this information generally does not change a lot, we could add a cache for the JSON response of this endpoint to help the metrics.

The cache introduced in #363867 (closed) (behind a feature flag), needs to be invalidated in some application events (&7920 (closed)).

!91422 (merged) introduced the required fields to invalidate this cache on Projects::ProjectDeletedEvent.

This MR

This MR uses the Projects::ProjectDeletedEvent to invalidate the cache cache introduced in #363867 (closed).

Related to: #364065 (closed)

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

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

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Kassio Borges

Merge request reports