mirror of
https://github.com/wahyd4/libr-2.git
synced 2026-08-09 05:15:53 +10:00
16 lines
276 B
Ruby
16 lines
276 B
Ruby
class ProcessPostWorker
|
|
include Sidekiq::Worker
|
|
|
|
sidekiq_options queue: :post, retry: 3
|
|
|
|
def perform url
|
|
post = Post.find_by url: url
|
|
page = Mechanize.new.get post.url
|
|
post.title = page.title().try(:strip)
|
|
post.processed = true
|
|
post.save
|
|
end
|
|
|
|
|
|
end
|