diff options
author | Toon Claes <toon@gitlab.com> | 2017-04-04 17:38:16 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-04-06 23:50:36 +0200 |
commit | 847b9c82326d4fa1c4ab28f0f500a374e92728cb (patch) | |
tree | 044f6fb772c80a2604e79ebf6ffabb3610d58172 /app/services/ci | |
parent | ebae10467d1bfa03370d131533f2905673c03f71 (diff) | |
download | gitlab-ce-847b9c82326d4fa1c4ab28f0f500a374e92728cb.tar.gz |
Use Etag caching for pipelines json
Enable caching in the Etag::Middleware and when a pipeline changes
status, expire the cache for the project pipelines path.
Diffstat (limited to 'app/services/ci')
-rw-r--r-- | app/services/ci/expire_pipeline_cache_service.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/services/ci/expire_pipeline_cache_service.rb b/app/services/ci/expire_pipeline_cache_service.rb new file mode 100644 index 00000000000..95afe72e735 --- /dev/null +++ b/app/services/ci/expire_pipeline_cache_service.rb @@ -0,0 +1,18 @@ +module Ci + class ExpirePipelineCacheService < BaseService + def execute(pipeline) + @pipeline = pipeline + + Gitlab::EtagCaching::Store.new.touch(project_pipelines_path) + end + + private + + def project_pipelines_path + Gitlab::Routing.url_helpers.namespace_project_pipelines_path( + project.namespace, + project, + format: :json) + end + end +end |