Explorar el Código

Merge pull request #366 from Zariel/batch-consistency

Inherit consistency from session in NewBatch
Ben Hood hace 10 años
padre
commit
1ff8661524
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      session.go

+ 4 - 1
session.go

@@ -734,7 +734,10 @@ func NewBatch(typ BatchType) *Batch {
 
 // NewBatch creates a new batch operation using defaults defined in the cluster
 func (s *Session) NewBatch(typ BatchType) *Batch {
-	return &Batch{Type: typ, rt: s.cfg.RetryPolicy, serialCons: s.cfg.SerialConsistency}
+	s.mu.RLock()
+	batch := &Batch{Type: typ, rt: s.cfg.RetryPolicy, serialCons: s.cfg.SerialConsistency, Cons: s.cons}
+	s.mu.RUnlock()
+	return batch
 }
 
 // Attempts returns the number of attempts made to execute the batch.