Fix Etag expiration for forked projects

When a pipeline is for a forked merge request, we have to invalidate
the ETag for both the target and source project pipelines. Before
we were only invalidating the target project's pipeline.
This commit is contained in:
Stan Hu 2019-02-21 14:30:33 -08:00 committed by Rémy Coutable
parent d193318338
commit c5c71299af
No known key found for this signature in database
GPG Key ID: 98DFFD1C0C62B70B
1 changed files with 3 additions and 3 deletions

View File

@ -37,9 +37,9 @@ class ExpirePipelineCacheWorker
Gitlab::Routing.url_helpers.project_new_merge_request_path(project, format: :json) Gitlab::Routing.url_helpers.project_new_merge_request_path(project, format: :json)
end end
def each_pipelines_merge_request_path(project, pipeline) def each_pipelines_merge_request_path(pipeline)
pipeline.all_merge_requests.each do |merge_request| pipeline.all_merge_requests.each do |merge_request|
path = Gitlab::Routing.url_helpers.pipelines_project_merge_request_path(project, merge_request, format: :json) path = Gitlab::Routing.url_helpers.pipelines_project_merge_request_path(merge_request.target_project, merge_request, format: :json)
yield(path) yield(path)
end end
@ -59,7 +59,7 @@ class ExpirePipelineCacheWorker
store.touch(project_pipeline_path(project, pipeline)) store.touch(project_pipeline_path(project, pipeline))
store.touch(commit_pipelines_path(project, pipeline.commit)) unless pipeline.commit.nil? store.touch(commit_pipelines_path(project, pipeline.commit)) unless pipeline.commit.nil?
store.touch(new_merge_request_pipelines_path(project)) store.touch(new_merge_request_pipelines_path(project))
each_pipelines_merge_request_path(project, pipeline) do |path| each_pipelines_merge_request_path(pipeline) do |path|
store.touch(path) store.touch(path)
end end
end end