lib/mail_spy/manager.rb in mail_spy-0.0.15 vs lib/mail_spy/manager.rb in mail_spy-0.0.16

- old
+ new

@@ -86,11 +86,11 @@ end while true emails = MailSpy::Email. limit(step).offset(offset). - where(:schedule_at.lte => current_time, :sent => false, :failed => false).all - break if emails.blank? + where(:schedule_at.lte => current_time, :sent => false, :failed => false).collect + break if emails.count <= 0 #returns enumerator which is never blank emails.each do |email| wq.enqueue_b do begin MailSpy::CoreMailer.template(email).deliver email.update_attribute(:sent, true)