Commit 03a70b84 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 165beade
......@@ -137,7 +137,7 @@ class ApplicationSetting < ApplicationRecord
validates :max_pages_size,
presence: true,
numericality: { only_integer: true, greater_than: 0,
numericality: { only_integer: true, greater_than_or_equal_to: 0,
less_than: ::Gitlab::Pages::MAX_SIZE / 1.megabyte }
validates :default_artifacts_expire_in, presence: true, duration: true
......
---
title: Allow 0 for pages size limit setting in admin settings
merge_request: 28086
author:
type: fixed
---
title: Make Rails.cache and Gitlab::Redis::Cache share the same Redis connection pool
merge_request: 28074
author:
type: performance
......@@ -258,18 +258,11 @@ module Gitlab
# Use caching across all environments
# Full list of options:
# https://api.rubyonrails.org/classes/ActiveSupport/Cache/RedisCacheStore.html#method-c-new
caching_config_hash = Gitlab::Redis::Cache.params
caching_config_hash = {}
caching_config_hash[:redis] = Gitlab::Redis::Cache.pool
caching_config_hash[:compress] = Gitlab::Utils.to_boolean(ENV.fetch('ENABLE_REDIS_CACHE_COMPRESSION', '1'))
caching_config_hash[:namespace] = Gitlab::Redis::Cache::CACHE_NAMESPACE
caching_config_hash[:expires_in] = 2.weeks # Cache should not grow forever
if Gitlab::Runtime.multi_threaded?
caching_config_hash[:pool_size] = Gitlab::Redis::Cache.pool_size
caching_config_hash[:pool_timeout] = 1
end
# Overrides RedisCacheStore's default value of 0
# This makes the default value the same with Gitlab::Redis::Cache
caching_config_hash[:reconnect_attempts] ||= ::Redis::Client::DEFAULTS[:reconnect_attempts]
config.cache_store = :redis_cache_store, caching_config_hash
......
......@@ -69,13 +69,15 @@ module Gitlab
end
def serialize_many_each(key, records, options)
enumerator = Enumerator.new do |items|
records.each do |record|
json = Raw.new(record.to_json(options))
json_writer.append(key, json)
items << Raw.new(record.to_json(options))
end
end
json_writer.write_relation_array(@exportable_path, key, enumerator)
end
def serialize_single_relation(key, record, options)
json = Raw.new(record.to_json(options))
......
......@@ -15,8 +15,11 @@ module Gitlab
delegate :params, :url, to: :new
def with
pool.with { |redis| yield redis }
end
def pool
@pool ||= ConnectionPool.new(size: pool_size) { ::Redis.new(params) }
@pool.with { |redis| yield redis }
end
def pool_size
......
......@@ -69,12 +69,12 @@ describe ApplicationSetting do
it { is_expected.to validate_numericality_of(:snippet_size_limit).only_integer.is_greater_than(0) }
it { is_expected.to validate_presence_of(:max_artifacts_size) }
it do
is_expected.to validate_numericality_of(:max_pages_size).only_integer.is_greater_than(0)
it { is_expected.to validate_numericality_of(:max_artifacts_size).only_integer.is_greater_than(0) }
it { is_expected.to validate_presence_of(:max_pages_size) }
it 'ensures max_pages_size is an integer greater than 0 (or equal to 0 to indicate unlimited/maximum)' do
is_expected.to validate_numericality_of(:max_pages_size).only_integer.is_greater_than_or_equal_to(0)
.is_less_than(::Gitlab::Pages::MAX_SIZE / 1.megabyte)
end
it { is_expected.to validate_numericality_of(:max_artifacts_size).only_integer.is_greater_than(0) }
it { is_expected.to validate_numericality_of(:max_pages_size).only_integer.is_greater_than(0) }
it { is_expected.not_to allow_value(7).for(:minimum_password_length) }
it { is_expected.not_to allow_value(129).for(:minimum_password_length) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment