Commit 525ab25a authored by Jacob Vosmaer's avatar Jacob Vosmaer

Changes suggested by Robert

parent 3170e5d2
class RepositoryCheckMailer < BaseMailer
include ActionView::Helpers::TextHelper
def notify(failed_count)
if failed_count == 1
@message = "One project failed its last repository check"
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
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