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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
b07c4e3d
Commit
b07c4e3d
authored
Apr 19, 2018
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `Rails.env.test?` from production code
parent
6dca7b5b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
14 deletions
+3
-14
app/workers/repository_check/batch_worker.rb
app/workers/repository_check/batch_worker.rb
+1
-12
spec/workers/repository_check/batch_worker_spec.rb
spec/workers/repository_check/batch_worker_spec.rb
+2
-2
No files found.
app/workers/repository_check/batch_worker.rb
View file @
b07c4e3d
...
@@ -15,7 +15,7 @@ module RepositoryCheck
...
@@ -15,7 +15,7 @@ module RepositoryCheck
# check, only one (or two) will be checked at a time.
# check, only one (or two) will be checked at a time.
project_ids
.
each
do
|
project_id
|
project_ids
.
each
do
|
project_id
|
break
if
Time
.
now
-
start
>=
RUN_TIME
break
if
Time
.
now
-
start
>=
RUN_TIME
break
unless
current_s
ettings
.
repository_checks_enabled
break
unless
Gitlab
::
CurrentS
ettings
.
repository_checks_enabled
next
unless
try_obtain_lease
(
project_id
)
next
unless
try_obtain_lease
(
project_id
)
...
@@ -47,16 +47,5 @@ module RepositoryCheck
...
@@ -47,16 +47,5 @@ module RepositoryCheck
timeout:
24
.
hours
timeout:
24
.
hours
).
try_obtain
).
try_obtain
end
end
def
current_settings
# No caching of the settings! If we cache them and an admin disables
# this feature, an active RepositoryCheckWorker would keep going for up
# to 1 hour after the feature was disabled.
if
Rails
.
env
.
test?
Gitlab
::
CurrentSettings
.
fake_application_settings
else
ApplicationSetting
.
current
end
end
end
end
end
end
spec/workers/repository_check/batch_worker_spec.rb
View file @
b07c4e3d
...
@@ -31,8 +31,8 @@ describe RepositoryCheck::BatchWorker do
...
@@ -31,8 +31,8 @@ describe RepositoryCheck::BatchWorker do
it
'does nothing when repository checks are disabled'
do
it
'does nothing when repository checks are disabled'
do
create
(
:project
,
created_at:
1
.
week
.
ago
)
create
(
:project
,
created_at:
1
.
week
.
ago
)
current_settings
=
double
(
'settings'
,
repository_checks_enabled:
false
)
expect
(
subject
).
to
receive
(
:current_settings
)
{
current_settings
}
stub_application_setting
(
repository_checks_enabled:
false
)
expect
(
subject
.
perform
).
to
eq
(
nil
)
expect
(
subject
.
perform
).
to
eq
(
nil
)
end
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