mail_spy 0.0.14 → 0.0.15

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.
@@ -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 => DateTime.now, :sent => false, :failed => false).all
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
@@ -1,3 +1,3 @@
1
1
  module MailSpy
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mail_spy
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.14
5
+ version: 0.0.15
6
6
  platform: ruby
7
7
  authors:
8
8
  - Timothy Cardenas