Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d7d1295b
Commit
d7d1295b
authored
Dec 18, 2019
by
Matthias Kaeppler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert runtime ID to be based on just classes
parent
581b3020
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
32 deletions
+3
-32
lib/gitlab/runtime.rb
lib/gitlab/runtime.rb
+3
-19
spec/lib/gitlab/runtime_spec.rb
spec/lib/gitlab/runtime_spec.rb
+0
-13
No files found.
lib/gitlab/runtime.rb
View file @
d7d1295b
...
...
@@ -18,16 +18,16 @@ module Gitlab
end
def
puma?
!!
(
defined?
(
::
Puma
)
&&
bin
==
'puma'
)
!!
defined?
(
::
Puma
)
end
# For unicorn, we need to check for actual server instances to avoid false positives.
def
unicorn?
!!
(
defined?
(
::
Unicorn
)
&&
defined?
(
::
Unicorn
::
HttpServer
)
)
!!
defined?
(
::
Unicorn
)
end
def
sidekiq?
!!
(
defined?
(
::
Sidekiq
)
&&
Sidekiq
.
server?
&&
bin
==
'sidekiq'
)
!!
Sidekiq
.
server?
end
def
console?
...
...
@@ -41,22 +41,6 @@ module Gitlab
def
multi_threaded?
puma?
||
sidekiq?
end
private
# Some example values from my system:
# puma: /data/cache/bundle-2.5/bin/puma
# unicorn: unicorn_rails master -E development -c /tmp/unicorn.rb -l 0.0.0.0:8080
# sidekiq: /data/cache/bundle-2.5/bin/sidekiq
# thin: bin/rails
# console: bin/rails
def
script_name
$0
end
def
bin
File
.
basename
(
script_name
)
end
end
end
end
spec/lib/gitlab/runtime_spec.rb
View file @
d7d1295b
...
...
@@ -3,12 +3,6 @@
require
'spec_helper'
describe
Gitlab
::
Runtime
do
REAL_PATH
=
$0
after
(
:all
)
do
$0
=
REAL_PATH
end
context
"when unknown"
do
it
"identifies as :unknown"
do
expect
(
subject
.
name
).
to
eq
(
:unknown
)
...
...
@@ -17,7 +11,6 @@ describe Gitlab::Runtime do
context
"on multiple matches"
do
before
do
$0
=
'/data/cache/bundle-2.5/bin/puma'
stub_const
(
'::Puma'
,
double
)
stub_const
(
'::Rails::Console'
,
double
)
end
...
...
@@ -31,7 +24,6 @@ describe Gitlab::Runtime do
let
(
:puma_type
)
{
double
(
'::Puma'
)
}
before
do
$0
=
'/data/cache/bundle-2.5/bin/puma'
stub_const
(
'::Puma'
,
puma_type
)
end
...
...
@@ -49,12 +41,9 @@ describe Gitlab::Runtime do
context
"unicorn"
do
let
(
:unicorn_type
)
{
Module
.
new
}
let
(
:unicorn_server_type
)
{
Class
.
new
}
before
do
$0
=
'unicorn_rails master -E development -c /tmp/unicorn.rb -l 0.0.0.0:8080'
stub_const
(
'::Unicorn'
,
unicorn_type
)
stub_const
(
'::Unicorn::HttpServer'
,
unicorn_server_type
)
end
it
"identifies itself"
do
...
...
@@ -73,7 +62,6 @@ describe Gitlab::Runtime do
let
(
:sidekiq_type
)
{
double
(
'::Sidekiq'
)
}
before
do
$0
=
'/data/cache/bundle-2.5/bin/sidekiq'
stub_const
(
'::Sidekiq'
,
sidekiq_type
)
allow
(
sidekiq_type
).
to
receive
(
:server?
).
and_return
(
true
)
end
...
...
@@ -94,7 +82,6 @@ describe Gitlab::Runtime do
let
(
:console_type
)
{
double
(
'::Rails::Console'
)
}
before
do
$0
=
'bin/rails'
stub_const
(
'::Rails::Console'
,
console_type
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment