Class: MailyHerald::Manager
- Inherits:
-
Object
- Object
- MailyHerald::Manager
- Defined in:
- lib/maily_herald/manager.rb
Class Method Summary collapse
-
.job_enqueued? ⇒ Boolean
Check if Maily sidekiq job is running.
-
.run_all ⇒ Object
Run all scheduled mailing deliveres.
-
.run_mailing(mailing) ⇒ Object
Run scheduled periodical mailing deliveres.
-
.run_sequence(sequence) ⇒ Object
Run scheduled sequence mailing deliveries.
Class Method Details
.job_enqueued? ⇒ Boolean
Check if Maily sidekiq job is running.
31 32 33 34 35 |
# File 'lib/maily_herald/manager.rb', line 31 def self.job_enqueued? Sidekiq::Queue.new.detect{|j| j.klass == "MailyHerald::Async" } || Sidekiq::Workers.new.detect{|w, msg| msg["payload"]["class"] == "MailyHerald::Async" } || Sidekiq::RetrySet.new.detect{|j| j.klass = "MailyHerald::Async" } end |
.run_all ⇒ Object
Run all scheduled mailing deliveres.
23 24 25 26 27 28 |
# File 'lib/maily_herald/manager.rb', line 23 def self.run_all AdHocMailing.all.each {|m| m.run} OneTimeMailing.all.each {|m| m.run} PeriodicalMailing.all.each {|m| m.run} Sequence.all.each {|m| m.run} end |