Class: Autopublisher

Inherits:
Object
  • Object
show all
Defined in:
app/models/autopublisher.rb

Class Method Summary collapse

Class Method Details

.queue!Object



14
15
16
17
18
19
# File 'app/models/autopublisher.rb', line 14

def queue!
  return unless queued_pages.any?
  PagesCore::AutopublishJob
    .set(wait_until: queued_pages.first.published_at)
    .perform_later
end

.run!(_options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'app/models/autopublisher.rb', line 3

def run!(_options = {})
  if due_pages.any?
    PagesCore::CacheSweeper.once do
      due_pages.each do |p|
        p.update(autopublish: false)
      end
    end
  end
  queue!
end