Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
87987632
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
87987632
编写于
5月 03, 2020
作者:
G
GitLab Bot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add latest changes from gitlab-org/gitlab@master
上级
b63f3afa
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
78 addition
and
17 deletion
+78
-17
cable/config.ru
cable/config.ru
+2
-0
changelogs/unreleased/sluongngoc-decouple-partial-clone.yml
changelogs/unreleased/sluongngoc-decouple-partial-clone.yml
+5
-0
config/gitlab.yml.example
config/gitlab.yml.example
+5
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+6
-0
config/initializers/action_cable.rb
config/initializers/action_cable.rb
+1
-0
lib/api/internal/base.rb
lib/api/internal/base.rb
+5
-4
lib/gitlab/runtime.rb
lib/gitlab/runtime.rb
+14
-8
qa/qa/resource/api_fabricator.rb
qa/qa/resource/api_fabricator.rb
+4
-1
qa/qa/support/api.rb
qa/qa/support/api.rb
+1
-0
spec/lib/gitlab/runtime_spec.rb
spec/lib/gitlab/runtime_spec.rb
+13
-0
spec/requests/api/internal/base_spec.rb
spec/requests/api/internal/base_spec.rb
+22
-4
未找到文件。
cable/config.ru
浏览文件 @
87987632
...
...
@@ -3,4 +3,6 @@
require
::
File
.
expand_path
(
'../../config/environment'
,
__FILE__
)
Rails
.
application
.
eager_load!
ACTION_CABLE_SERVER
=
true
run
ActionCable
.
server
changelogs/unreleased/sluongngoc-decouple-partial-clone.yml
0 → 100644
浏览文件 @
87987632
---
title
:
Decouple partial clone config from max input size
merge_request
:
30354
author
:
Son Luong Ngoc
type
:
changed
config/gitlab.yml.example
浏览文件 @
87987632
...
...
@@ -1065,6 +1065,11 @@ production: &base
# host: localhost
# port: 3808
## ActionCable settings
action_cable:
# Number of threads used to process ActionCable connection callbacks and channel actions
# worker_pool_size: 4
## Monitoring
# Built in monitoring settings
monitoring:
...
...
config/initializers/1_settings.rb
浏览文件 @
87987632
...
...
@@ -717,6 +717,12 @@ Settings.webpack.dev_server['enabled'] ||= false
Settings
.
webpack
.
dev_server
[
'host'
]
||=
'localhost'
Settings
.
webpack
.
dev_server
[
'port'
]
||=
3808
#
# ActionCable settings
#
Settings
[
'action_cable'
]
||=
Settingslogic
.
new
({})
Settings
.
action_cable
[
'worker_pool_size'
]
||=
4
#
# Monitoring settings
#
...
...
config/initializers/actioncable.rb
→
config/initializers/action
_
cable.rb
浏览文件 @
87987632
...
...
@@ -5,4 +5,5 @@ Rails.application.configure do
# we're running ActionCable as a standalone server
config
.
action_cable
.
mount_path
=
nil
config
.
action_cable
.
url
=
Gitlab
::
Utils
.
append_path
(
Gitlab
.
config
.
gitlab
.
relative_url_root
,
'/-/cable'
)
config
.
action_cable
.
worker_pool_size
=
Gitlab
.
config
.
action_cable
.
worker_pool_size
end
lib/api/internal/base.rb
浏览文件 @
87987632
...
...
@@ -69,13 +69,14 @@ module API
}
# Custom option for git-receive-pack command
if
Feature
.
enabled?
(
:gitaly_upload_pack_filter
,
project
,
default_enabled:
true
)
payload
[
:git_config_options
]
<<
"uploadpack.allowFilter=true"
<<
"uploadpack.allowAnySHA1InWant=true"
end
receive_max_input_size
=
Gitlab
::
CurrentSettings
.
receive_max_input_size
.
to_i
if
receive_max_input_size
>
0
payload
[
:git_config_options
]
<<
"receive.maxInputSize=
#{
receive_max_input_size
.
megabytes
}
"
if
Feature
.
enabled?
(
:gitaly_upload_pack_filter
,
project
,
default_enabled:
true
)
payload
[
:git_config_options
]
<<
"uploadpack.allowFilter=true"
<<
"uploadpack.allowAnySHA1InWant=true"
end
end
response_with_status
(
**
payload
)
...
...
lib/gitlab/runtime.rb
浏览文件 @
87987632
...
...
@@ -37,7 +37,7 @@ module Gitlab
end
def
puma?
!!
defined?
(
::
Puma
)
!!
defined?
(
::
Puma
)
&&
!
defined?
(
ACTION_CABLE_SERVER
)
end
# For unicorn, we need to check for actual server instances to avoid false positives.
...
...
@@ -70,25 +70,31 @@ module Gitlab
end
def
web_server?
puma?
||
unicorn?
puma?
||
unicorn?
||
action_cable?
end
def
action_cable?
!!
defined?
(
ACTION_CABLE_SERVER
)
end
def
multi_threaded?
puma?
||
sidekiq?
puma?
||
sidekiq?
||
action_cable?
end
def
max_threads
main_thread
=
1
if
puma?
Puma
.
cli_config
.
options
[
:max_threads
]
+
main_thread
if
action_cable?
Gitlab
::
Application
.
config
.
action_cable
.
worker_pool_size
elsif
puma?
Puma
.
cli_config
.
options
[
:max_threads
]
elsif
sidekiq?
# An extra thread for the poller in Sidekiq Cron:
# https://github.com/ondrejbartas/sidekiq-cron#under-the-hood
Sidekiq
.
options
[
:concurrency
]
+
main_thread
+
1
Sidekiq
.
options
[
:concurrency
]
+
1
else
main_thread
end
0
end
+
main_thread
end
end
end
...
...
qa/qa/resource/api_fabricator.rb
浏览文件 @
87987632
...
...
@@ -14,6 +14,7 @@ module QA
ResourceQueryError
=
Class
.
new
(
RuntimeError
)
ResourceUpdateFailedError
=
Class
.
new
(
RuntimeError
)
ResourceURLMissingError
=
Class
.
new
(
RuntimeError
)
InternalServerError
=
Class
.
new
(
RuntimeError
)
attr_reader
:api_resource
,
:api_response
attr_writer
:api_client
...
...
@@ -85,7 +86,9 @@ module QA
url
=
Runtime
::
API
::
Request
.
new
(
api_client
,
get_path
).
url
response
=
get
(
url
)
unless
response
.
code
==
HTTP_STATUS_OK
if
response
.
code
==
HTTP_STATUS_SERVER_ERROR
raise
InternalServerError
,
"Failed to GET
#{
url
}
- (
#{
response
.
code
}
): `
#{
response
}
`."
elsif
response
.
code
!=
HTTP_STATUS_OK
raise
ResourceNotFoundError
,
"Resource at
#{
url
}
could not be found (
#{
response
.
code
}
): `
#{
response
}
`."
end
...
...
qa/qa/support/api.rb
浏览文件 @
87987632
...
...
@@ -7,6 +7,7 @@ module QA
HTTP_STATUS_CREATED
=
201
HTTP_STATUS_NO_CONTENT
=
204
HTTP_STATUS_ACCEPTED
=
202
HTTP_STATUS_SERVER_ERROR
=
500
def
post
(
url
,
payload
)
RestClient
::
Request
.
execute
(
...
...
spec/lib/gitlab/runtime_spec.rb
浏览文件 @
87987632
...
...
@@ -105,4 +105,17 @@ describe Gitlab::Runtime do
it_behaves_like
"valid runtime"
,
:rails_runner
,
1
end
context
"action_cable"
do
before
do
stub_const
(
'ACTION_CABLE_SERVER'
,
true
)
stub_const
(
'::Puma'
,
Module
.
new
)
allow
(
Gitlab
::
Application
).
to
receive_message_chain
(
:config
,
:action_cable
,
:worker_pool_size
).
and_return
(
8
)
end
it
"reports its maximum concurrency based on ActionCable's worker pool size"
do
expect
(
subject
.
max_threads
).
to
eq
(
9
)
end
end
end
spec/requests/api/internal/base_spec.rb
浏览文件 @
87987632
...
...
@@ -441,10 +441,11 @@ describe API::Internal::Base do
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:receive_max_input_size
)
{
1
}
end
it
'returns
custom
git config'
do
it
'returns
maxInputSize and partial clone
git config'
do
push
(
key
,
project
)
expect
(
json_response
[
"git_config_options"
]).
to
be_present
expect
(
json_response
[
"git_config_options"
]).
to
include
(
"receive.maxInputSize=1048576"
)
expect
(
json_response
[
"git_config_options"
]).
to
include
(
"uploadpack.allowFilter=true"
)
expect
(
json_response
[
"git_config_options"
]).
to
include
(
"uploadpack.allowAnySHA1InWant=true"
)
end
...
...
@@ -454,10 +455,11 @@ describe API::Internal::Base do
stub_feature_flags
(
gitaly_upload_pack_filter:
{
enabled:
false
,
thing:
project
})
end
it
'
does not include allowFilter and allowAnySha1InWant in the git config options
'
do
it
'
returns only maxInputSize and not partial clone git config
'
do
push
(
key
,
project
)
expect
(
json_response
[
"git_config_options"
]).
to
be_present
expect
(
json_response
[
"git_config_options"
]).
to
include
(
"receive.maxInputSize=1048576"
)
expect
(
json_response
[
"git_config_options"
]).
not_to
include
(
"uploadpack.allowFilter=true"
)
expect
(
json_response
[
"git_config_options"
]).
not_to
include
(
"uploadpack.allowAnySHA1InWant=true"
)
end
...
...
@@ -465,12 +467,28 @@ describe API::Internal::Base do
end
context
'when receive_max_input_size is empty'
do
it
'returns an empty git config'
do
before
do
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:receive_max_input_size
)
{
nil
}
end
it
'returns partial clone git config'
do
push
(
key
,
project
)
expect
(
json_response
[
"git_config_options"
]).
to
be_empty
expect
(
json_response
[
"git_config_options"
]).
to
be_present
expect
(
json_response
[
"git_config_options"
]).
to
include
(
"uploadpack.allowFilter=true"
)
expect
(
json_response
[
"git_config_options"
]).
to
include
(
"uploadpack.allowAnySHA1InWant=true"
)
end
context
'when gitaly_upload_pack_filter feature flag is disabled'
do
before
do
stub_feature_flags
(
gitaly_upload_pack_filter:
{
enabled:
false
,
thing:
project
})
end
it
'returns an empty git config'
do
push
(
key
,
project
)
expect
(
json_response
[
"git_config_options"
]).
to
be_empty
end
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录