Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-31 00:07:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-31 00:07:58 +0300
commit0f0a8be306e7e0cd5693f57414de351808c41db9 (patch)
treed392e35e7b45c88de68cc5d433fac5ff98bb8504 /lib
parent3fe9588b1c1c4fb58f8ba8e9c27244fc2fc1c103 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/ci/status/build/failed.rb4
-rw-r--r--lib/gitlab/repository_cache_adapter.rb13
-rw-r--r--lib/gitlab/repository_set_cache.rb11
3 files changed, 17 insertions, 11 deletions
diff --git a/lib/gitlab/ci/status/build/failed.rb b/lib/gitlab/ci/status/build/failed.rb
index 961012c2cee..910d93f54ce 100644
--- a/lib/gitlab/ci/status/build/failed.rb
+++ b/lib/gitlab/ci/status/build/failed.rb
@@ -16,7 +16,9 @@ module Gitlab
stale_schedule: 'stale schedule',
job_execution_timeout: 'job execution timeout',
archived_failure: 'archived failure',
- unmet_prerequisites: 'unmet prerequisites'
+ unmet_prerequisites: 'unmet prerequisites',
+ scheduler_failure: 'scheduler failure',
+ data_integrity_failure: 'data integrity failure'
}.freeze
private_constant :REASONS
diff --git a/lib/gitlab/repository_cache_adapter.rb b/lib/gitlab/repository_cache_adapter.rb
index b2dc92ce010..6d216217bdf 100644
--- a/lib/gitlab/repository_cache_adapter.rb
+++ b/lib/gitlab/repository_cache_adapter.rb
@@ -58,11 +58,16 @@ module Gitlab
# wrong answer. We handle that by querying the full list - which fills
# the cache - and using it directly to answer the question.
define_method("#{name}_include?") do |value|
- if strong_memoized?(name) || !redis_set_cache.exist?(name)
- return __send__(name).include?(value) # rubocop:disable GitlabSecurity/PublicSend
- end
+ return __send__(name).include?(value) if strong_memoized?(name) # rubocop:disable GitlabSecurity/PublicSend
+
+ # If the member exists in the set, return as such early.
+ return true if redis_set_cache.include?(name, value)
+
+ # If it did not, make sure the collection exists.
+ # If the collection exists, then item does not.
+ return false if redis_set_cache.exist?(name)
- redis_set_cache.include?(name, value)
+ __send__(name).include?(value) # rubocop:disable GitlabSecurity/PublicSend
end
end
diff --git a/lib/gitlab/repository_set_cache.rb b/lib/gitlab/repository_set_cache.rb
index 6d3ac53a787..8035946090a 100644
--- a/lib/gitlab/repository_set_cache.rb
+++ b/lib/gitlab/repository_set_cache.rb
@@ -25,7 +25,7 @@ module Gitlab
end
def read(key)
- with { |redis| redis.smembers(cache_key(key)) }
+ with { |redis| redis.sscan_each(cache_key(key)).to_a }
end
def write(key, value)
@@ -47,11 +47,10 @@ module Gitlab
end
def fetch(key, &block)
- if exist?(key)
- read(key)
- else
- write(key, yield)
- end
+ result = read(key)
+ return result unless result.empty?
+
+ write(key, yield)
end
def include?(key, value)