Commit graph

17 commits

Author SHA1 Message Date
Lin Jen-Shin
d5c7fe29c8 Add docs for RequestCache, moved from comments 2018-06-22 18:18:42 +08:00
Lin Jen-Shin
4b30aec0aa Allow rake cache:clear clearing pipeline status cache
* Use the correct key prefix
* Clear old cache keys

TODO:

At some point we could remove clearing old cache keys.
2018-04-10 20:57:00 +08:00
Lin Jen-Shin
9ac0c76b78 Use StrongMemoize and enable/disable cops properly 2017-11-18 01:01:53 +08:00
Lin Jen-Shin
9ae92b8caa Add cop to make sure we don't use ivar in a module 2017-09-18 21:23:45 +08:00
Robert Speicher
260c8da060 Whitelist or fix additional Gitlab/PublicSend cop violations
An upcoming update to rubocop-gitlab-security added additional
violations.
2017-08-14 12:14:11 -04:00
Lin Jen-Shin
3922b80329 Rename the methods to make it fit with current name 2017-07-18 18:04:20 +08:00
Lin Jen-Shin
ffc5b29bd0 Follow feedback on the merge request 2017-07-18 17:48:48 +08:00
Lin Jen-Shin
76c9f071db Update the comments for the new functionality 2017-07-18 01:30:58 +08:00
Lin Jen-Shin
aada5273fa Use RequestStoreWrap for Commit#author
We also try to use instance variable to cache the result if
RequestStore is not available, so we could keep the same logic,
using the same cache key. Also introduce a way to specify method
specific cache key
2017-07-18 01:18:20 +08:00
Lin Jen-Shin
143fc48aba Add RequestStoreWrap to cache via RequestStore
I don't like the idea of `RequestStore` at all, because it's just a
global state which shouldn't be used at all. But we have a number of
places calling `ProtectedBranch.protected?` and `ProtectedTag.protected?`
in a loop for the same user, project, and ref whenever we're checking
against if the jobs for a given pipeline is accessible for a given user.
This means we're effectively making N queries for the same thing over
and over.

To properly fix this, we need to change how we check the permission,
and that could be a huge work. To solve this quickly, adding a cache
layer for the given request would be quite simple to do.

We're already doing this in Commit#author, and this is extending that
idea and make it generalized.
2017-07-17 23:24:46 +08:00
Paul Charlton
cb3b4a15e6 Support multiple Redis instances based on queue type 2017-07-11 03:35:47 +00:00
Grzegorz Bizon
0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Bob Van Landuyt
019b06b9d2 Load a project's CI status in batch from redis 2017-04-26 12:04:22 +00:00
Bob Van Landuyt
516a405eb2 Take the ref of a pipeline into account when caching status 2017-04-07 17:24:11 +02:00
Bob Van Landuyt
02072e17ab Rename ProjectBuildStatus -> ProjectPipelineStatus 2017-04-07 17:24:11 +02:00
Bob Van Landuyt
a6d313001a Wrap updating of cache after pipeline transition in class method 2017-04-07 17:24:11 +02:00
Bob Van Landuyt
9082d1e046 Rename Ci::PipelineStatus -> Ci::ProjectBuildStatus 2017-04-07 17:24:11 +02:00