summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-04-12 18:15:15 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-04-12 18:15:15 +0200
commit525ab25ac81a6b81cca56d3cba403ab2a5f372eb (patch)
treeb75bf78592a53a02bc84081011c816a96a4ad379
parent3170e5d226ee107409b4345b827519da64ba967e (diff)
downloadgitlab-ce-525ab25ac81a6b81cca56d3cba403ab2a5f372eb.tar.gz
Changes suggested by Robert
-rw-r--r--app/mailers/repository_check_mailer.rb2
-rw-r--r--app/views/admin/application_settings/_form.html.haml2
-rw-r--r--app/workers/repository_check_worker.rb2
-rw-r--r--spec/workers/repository_check_worker_spec.rb6
4 files changed, 5 insertions, 7 deletions
diff --git a/app/mailers/repository_check_mailer.rb b/app/mailers/repository_check_mailer.rb
index 994054c8769..2bff5b63cc4 100644
--- a/app/mailers/repository_check_mailer.rb
+++ b/app/mailers/repository_check_mailer.rb
@@ -1,6 +1,4 @@
class RepositoryCheckMailer < BaseMailer
- include ActionView::Helpers::TextHelper
-
def notify(failed_count)
if failed_count == 1
@message = "One project failed its last repository check"
diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml
index 533a2f42973..555aea554f0 100644
--- a/app/views/admin/application_settings/_form.html.haml
+++ b/app/views/admin/application_settings/_form.html.haml
@@ -287,7 +287,7 @@
.col-sm-offset-2.col-sm-10
= link_to 'Clear all repository checks', clear_repository_check_states_admin_application_settings_path, data: { confirm: 'This will clear repository check states for ALL projects in the database. This cannot be undone. Are you sure?' }, method: :put, class: "btn btn-sm btn-remove"
.help-block
- If you got a lot of false alarms from repository checks (maybe your fileserver was temporarily unavailable) you can choose to clear all repository check information from the database.
+ If you got a lot of false alarms from repository checks you can choose to clear all repository check information from the database.
.form-actions
diff --git a/app/workers/repository_check_worker.rb b/app/workers/repository_check_worker.rb
index 017f49de08c..bdacdd4c6b0 100644
--- a/app/workers/repository_check_worker.rb
+++ b/app/workers/repository_check_worker.rb
@@ -17,7 +17,7 @@ class RepositoryCheckWorker
break if Time.now - start >= RUN_TIME
break unless current_settings.repository_checks_enabled
- next if !try_obtain_lease(project_id)
+ next unless try_obtain_lease(project_id)
SingleRepositoryCheckWorker.new.perform(project_id)
end
diff --git a/spec/workers/repository_check_worker_spec.rb b/spec/workers/repository_check_worker_spec.rb
index 13493ad2c6a..7a757658e97 100644
--- a/spec/workers/repository_check_worker_spec.rb
+++ b/spec/workers/repository_check_worker_spec.rb
@@ -4,7 +4,7 @@ describe RepositoryCheckWorker do
subject { RepositoryCheckWorker.new }
it 'prefers projects that have never been checked' do
- projects = 3.times.map { create(:project) }
+ projects = create_list(:project, 3)
projects[0].update_column(:last_repository_check_at, 1.month.ago)
projects[2].update_column(:last_repository_check_at, 3.weeks.ago)
@@ -12,7 +12,7 @@ describe RepositoryCheckWorker do
end
it 'sorts projects by last_repository_check_at' do
- projects = 3.times.map { create(:project) }
+ projects = create_list(:project, 3)
projects[0].update_column(:last_repository_check_at, 2.weeks.ago)
projects[1].update_column(:last_repository_check_at, 1.month.ago)
projects[2].update_column(:last_repository_check_at, 3.weeks.ago)
@@ -21,7 +21,7 @@ describe RepositoryCheckWorker do
end
it 'excludes projects that were checked recently' do
- projects = 3.times.map { create(:project) }
+ projects = create_list(:project, 3)
projects[0].update_column(:last_repository_check_at, 2.days.ago)
projects[1].update_column(:last_repository_check_at, 1.month.ago)
projects[2].update_column(:last_repository_check_at, 3.days.ago)