Skip to content

Commit

Permalink
SRCH-1356 Separate sitemap and searchgov queues (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrae authored Jul 27, 2020
1 parent 20e1646 commit f58900a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/jobs/sitemap_indexer_job.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class SitemapIndexerJob < ApplicationJob
queue_as :searchgov
queue_as :sitemap

def perform(sitemap_url:)
SitemapIndexer.new(sitemap_url: sitemap_url).index
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/sitemap_monitor_job.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class SitemapMonitorJob < ApplicationJob
queue_as :searchgov
queue_as :sitemap

def perform
SearchgovDomain.ok.each do |searchgov_domain|
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/sitemap_indexer_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
let(:indexer) { instance_double(SitemapIndexer) }
subject(:perform) { SitemapIndexerJob.perform_now(args) }

it_behaves_like 'a searchgov job'
it_behaves_like 'a sitemap job'

it 'indexes the sitemap' do
allow(SitemapIndexer).to receive(:new).with(args).and_return(indexer)
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/sitemap_monitor_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let(:searchgov_domain) { instance_double(SearchgovDomain) }
subject(:perform) { SitemapMonitorJob.perform_now }

it_behaves_like 'a searchgov job'
it_behaves_like 'a sitemap job'

context 'when domains can be indexed' do
before do
Expand Down
9 changes: 9 additions & 0 deletions spec/support/sitemap_job_behavior.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
shared_examples_for 'a sitemap job' do
let(:args) { nil }

it 'uses the "sitemap" queue' do
expect{
described_class.perform_later(args)
}.to have_enqueued_job.on_queue('sitemap')
end
end

0 comments on commit f58900a

Please sign in to comment.