Skip to content

Commit 5c62faa

Browse files
committed
Ignore inactive repos on tasks
1 parent 4ac64f7 commit 5c62faa

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lib/tasks/schedule.rake

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,14 @@ namespace :schedule do
1313

1414
desc "pulls in files from repos and adds them to the database"
1515
task process_repos: :environment do
16-
Repo.where("docs_subscriber_count > 0").select(:id, :removed_from_github).find_each(batch_size: 1000) do |repo|
17-
next if repo.removed_from_github?
18-
16+
Repo.active.where("docs_subscriber_count > 0").select(:id).find_each(batch_size: 1000) do |repo|
1917
PopulateDocsJob.perform_later(repo.id)
2018
end
2119
end
2220

2321
desc 'Populates github issues'
2422
task populate_issues: :environment do
25-
Repo.select(:id, :removed_from_github).find_each(batch_size: 100) do |repo|
26-
next if repo.removed_from_github?
27-
23+
Repo.active.select(:id, :removed_from_github).find_each(batch_size: 100) do |repo|
2824
PopulateIssuesJob.perform_later(repo.id)
2925
end
3026
end
@@ -50,9 +46,7 @@ namespace :schedule do
5046
desc 'Marks issues as closed'
5147
task mark_closed: :environment do
5248
Issue.queue_mark_old_as_closed!
53-
Repo.find_each(batch_size: 100) do |repo|
54-
next if repo.removed_from_github?
55-
49+
Repo.active.find_each(batch_size: 100) do |repo|
5650
repo.force_issues_count_sync!
5751
end
5852
end
@@ -109,7 +103,7 @@ namespace :schedule do
109103

110104
desc 'fetch and assign labels for repos'
111105
task fetch_labels_and_assign: :environment do
112-
Repo.find_each(batch_size: 100) do |repo|
106+
Repo.active.find_each(batch_size: 100) do |repo|
113107
RepoLabelAssigner.new(repo: repo).create_and_associate_labels!
114108
end
115109
end

0 commit comments

Comments
 (0)