diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-06 12:12:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-06 12:12:47 +0300 |
commit | 08608c8e9e9821858dd2f452a3c9ebfb945ab69f (patch) | |
tree | c3450c88bef3c68d70c4f814858913aafce5a59f /app/controllers | |
parent | 50b6f6a78828c6a455887b1ba2bdc049b1b1eff2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/pipelines_controller.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index cd2db2dad2c..7df902d8bec 100644 --- a/app/controllers/projects/pipelines_controller.rb +++ b/app/controllers/projects/pipelines_controller.rb @@ -166,6 +166,8 @@ class Projects::PipelinesController < Projects::ApplicationController @stage = pipeline.stage(params[:stage]) return not_found unless @stage + return unless stage_stale? + render json: StageSerializer .new(project: @project, current_user: @current_user) .represent(@stage, details: true, retried: params[:retried]) @@ -263,6 +265,15 @@ class Projects::PipelinesController < Projects::ApplicationController redirect_to url_for(safe_params.except(:scope).merge(status: safe_params[:scope])), status: :moved_permanently end + def stage_stale? + return true if Feature.disabled?(:pipeline_stage_set_last_modified, @current_user) + + last_modified = [@stage.updated_at.utc, @stage.statuses.maximum(:updated_at)].max + + expires_in 24.hours + stale?(last_modified: last_modified, etag: @stage) + end + # rubocop: disable CodeReuse/ActiveRecord def pipeline return @pipeline if defined?(@pipeline) |