mail_spy 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mail_spy/manager.rb +4 -1
- data/lib/mail_spy/version.rb +1 -1
- metadata +1 -1
data/lib/mail_spy/manager.rb
CHANGED
@@ -74,6 +74,7 @@ module MailSpy
|
|
74
74
|
raise "No Email service providers installed" unless MailSpy.esps.present?
|
75
75
|
|
76
76
|
wq = WorkQueue.new(num_threads, step*2)
|
77
|
+
current_time = DateTime.now
|
77
78
|
offset = 0
|
78
79
|
sent = 0
|
79
80
|
|
@@ -87,7 +88,7 @@ module MailSpy
|
|
87
88
|
while true
|
88
89
|
emails = MailSpy::Email.
|
89
90
|
limit(step).offset(offset).
|
90
|
-
where(:schedule_at.lte =>
|
91
|
+
where(:schedule_at.lte => current_time, :sent => false, :failed => false).all
|
91
92
|
break if emails.blank?
|
92
93
|
emails.each do |email|
|
93
94
|
wq.enqueue_b do
|
@@ -103,6 +104,8 @@ module MailSpy
|
|
103
104
|
end
|
104
105
|
end
|
105
106
|
end
|
107
|
+
# We must join here otherwise the next loop email lookup will be in a
|
108
|
+
# race condition with the results of our worker_queue.
|
106
109
|
wq.join
|
107
110
|
offset += step
|
108
111
|
end
|
data/lib/mail_spy/version.rb
CHANGED