eventus 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/eventus/persistence/mongo.rb +7 -7
- data/lib/eventus/version.rb +1 -1
- metadata +1 -1
@@ -14,15 +14,15 @@ module Eventus
|
|
14
14
|
def commit(events)
|
15
15
|
seqs = events.map{|e| e['sequence']}
|
16
16
|
doc = {
|
17
|
-
_id
|
18
|
-
sid
|
19
|
-
min
|
20
|
-
max
|
21
|
-
events
|
22
|
-
dispatched
|
17
|
+
'_id' => "#{events[0]['sid']}_#{seqs.min}",
|
18
|
+
'sid' => events[0]['sid'],
|
19
|
+
'min' => seqs.min,
|
20
|
+
'max' => seqs.max,
|
21
|
+
'events' => events,
|
22
|
+
'dispatched' => false
|
23
23
|
}
|
24
24
|
|
25
|
-
future = @commits.find_one({sid:doc[
|
25
|
+
future = @commits.find_one({sid:doc['sid'], max:{:$gte => doc['min']}})
|
26
26
|
raise Eventus::ConcurrencyError if future
|
27
27
|
begin
|
28
28
|
@commits.insert(doc, safe:true)
|
data/lib/eventus/version.rb
CHANGED