Class: Autopublisher

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

Class Method Summary collapse

Class Method Details

.queue!Object



16
17
18
19
20
21
22
# File 'app/models/autopublisher.rb', line 16

def queue!
  return unless queued_pages.any?

  PagesCore::AutopublishJob
    .set(wait_until: queued_pages.first.published_at)
    .perform_later
end

.run!(_options = {}) ⇒ Object



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

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