Skip to content

Commit 262c682

Browse files
committed
Fixed typo in SitemapRefreshWorker. Configured to use the full url not just the path.
1 parent dcd965b commit 262c682

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

app/workers/sitemap_refresh_worker.rb

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,46 @@
11
class SitemapRefreshWorker
22
include Sidekiq::Worker
3-
sidekiq_options queue: :high
3+
4+
sidekiq_options queue: :sitemap_generator
45

56
def perform
6-
SitemapGenerator::Sitemap.default_host = "https://coderwall.com"
7-
SitemapGenerator::Sitemap.public_path = 'tmp/'
7+
SitemapGenerator::Sitemap.default_host = 'https://coderwall.com'
8+
SitemapGenerator::Sitemap.public_url = 'tmp/'
89
SitemapGenerator::Sitemap.sitemaps_host = "http://#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com/"
9-
SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/'
10-
SitemapGenerator::Sitemap.adapter = SitemapGenerator::WaveAdapter.new
10+
SitemapGenerator::Sitemap.sitemaps_url = 'sitemaps/'
11+
SitemapGenerator::Sitemap.adapter = SitemapGenerator::WaveAdapter.new
1112

1213
SitemapGenerator::Sitemap.create do
13-
add '/welcome', :priority => 0.7, :changefreq => 'montlhy'
14-
add '/contact_us', :priority => 0.5, :changefreq => 'montlhy'
15-
add '/blog', :priority => 0.7, :changefreq => 'weekly'
16-
add '/api', :priority => 0.5, :changefreq => 'monthly'
17-
add '/faq', :priority => 0.5, :changefreq => 'monthly'
18-
add '/privacy_policy', :priority => 0.2, :changefreq => 'monthly'
19-
add '/tos', :priority => 0.2, :changefreq => 'monthly'
20-
add '/jobs', :priority => 0.7, :changefreq => 'daily'
21-
add '/employers', :priority => 0.7, :changefreq => 'monthly'
22-
Protip.find_each do |protip|
23-
add protip_path(protip), :lastmod => protip.updated_at
14+
add('https://coderwall.com/welcome', priority: 0.7, changefreq: 'monthly')
15+
add('https://coderwall.com/contact_us', priority: 0.2, changefreq: 'monthly')
16+
add('https://coderwall.com/blog', priority: 0.5, changefreq: 'weekly')
17+
add('https://coderwall.com/api', priority: 0.2, changefreq: 'monthly')
18+
add('https://coderwall.com/faq', priority: 0.2, changefreq: 'monthly')
19+
add('https://coderwall.com/privacy_policy', priority: 0.2, changefreq: 'monthly')
20+
add('https://coderwall.com/tos', priority: 0.2, changefreq: 'monthly')
21+
add('https://coderwall.com/jobs', priority: 0.8, changefreq: 'daily')
22+
add('https://coderwall.com/employers', priority: 0.7, changefreq: 'monthly')
23+
24+
Protip.find_each(batch_size: 30) do |protip|
25+
add(protip_url(protip), lastmod: protip.updated_at, priority: 1.0)
2426
end
27+
2528
Team.all.each do |team|
26-
add teamname_path(slug: team.slug), :lastmod => team.updated_at
29+
add(teamname_url(slug: team.slug), lastmod: team.updated_at, priority: 0.9)
2730
team.jobs.each do |job|
28-
add job_path(:slug => team.slug, :job_id => job.public_id), :lastmod => job.updated_at
31+
add(job_url(slug: team.slug, job_id: job.public_id), lastmod: job.updated_at, priority: 1.0)
2932
end
3033
end
31-
User.find_each do |user|
32-
add badge_path(user.username), :lastmod => user.updated_at
34+
35+
User.find_each(batch_size: 30) do |user|
36+
add(badge_url(user.username), lastmod: user.updated_at, priority: 0.9)
3337
end
38+
3439
BlogPost.all_public.each do |blog_post|
35-
add blog_post_path(blog_post.id), :lastmod => blog_post.posted
40+
add(blog_post_url(blog_post.id), lastmod: blog_post.posted, priority: 0.5)
3641
end
3742
end
43+
3844
SitemapGenerator::Sitemap.ping_search_engines
3945
end
40-
end
46+
end

0 commit comments

Comments
 (0)