dvdplm-ar_mailer 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,7 +46,7 @@ class ActionMailer::ARSendmail
46
46
  ##
47
47
  # The version of ActionMailer::ARSendmail you are running.
48
48
 
49
- VERSION = '2.0.6'
49
+ VERSION = '2.0.7'
50
50
 
51
51
  ##
52
52
  # Maximum number of times authentication will be consecutively retried
@@ -432,7 +432,7 @@ end
432
432
  def cleanup
433
433
  return if @max_age == 0
434
434
  timeout = Time.now - @max_age
435
- conditions = ['last_send_attempt > 0 and created_at < ?', timeout]
435
+ conditions = ['last_send_attempt > 0 AND created_at < ? AND sent_at IS NULL', timeout]
436
436
  mail = @email_class.update_all({:failed => true}, conditions)
437
437
 
438
438
  log "#{self.class}#cleanup expired #{mail} emails from the queue"
@@ -519,7 +519,7 @@ end
519
519
  # last 300 seconds.
520
520
 
521
521
  def find_emails
522
- options = { :conditions => {:sent_at => nil, :failed => false}}
522
+ options = { :conditions => ['sent_at IS NULL AND failed = 0 AND (? - last_send_attempt) > 300', Time.now.to_i]}
523
523
  options[:limit] = batch_size unless batch_size.nil?
524
524
  mail = @email_class.find :all, options
525
525
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dvdplm-ar_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel