Ensure that quads in a transaction are applied in the desired order.

This commit is contained in:
Quentin Machu 2015-11-17 12:05:16 -05:00
parent 174a13cf23
commit 383cb339ac
2 changed files with 46 additions and 25 deletions

View file

@ -109,11 +109,9 @@ func (s *Single) Close() error {
func (s *Single) ApplyTransaction(t *graph.Transaction) error {
ts := time.Now()
deltas := make([]graph.Delta, 0, len(t.Deltas))
for d := range t.Deltas {
d.ID = s.currentID.Next()
d.Timestamp = ts
deltas = append(deltas, d)
for i := 0; i < len(t.Deltas); i++ {
t.Deltas[i].ID = s.currentID.Next()
t.Deltas[i].Timestamp = ts
}
return s.qs.ApplyDeltas(deltas, s.ignoreOpts)
return s.qs.ApplyDeltas(t.Deltas, s.ignoreOpts)
}