浏览代码

Drop the default retry to 5 and make it configurable via a flag

Ben Hood 11 年之前
父节点
当前提交
70b05d2438
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      cassandra_test.go

+ 2 - 1
cassandra_test.go

@@ -27,6 +27,7 @@ var (
 	flagProto    = flag.Int("proto", 2, "protcol version")
 	flagProto    = flag.Int("proto", 2, "protcol version")
 	flagCQL      = flag.String("cql", "3.0.0", "CQL version")
 	flagCQL      = flag.String("cql", "3.0.0", "CQL version")
 	flagRF       = flag.Int("rf", 1, "replication factor for test keyspace")
 	flagRF       = flag.Int("rf", 1, "replication factor for test keyspace")
+	flagRetry    = flag.Int("retries", 5, "number of times to retry queries")
 	clusterSize  = 1
 	clusterSize  = 1
 	clusterHosts []string
 	clusterHosts []string
 )
 )
@@ -56,7 +57,7 @@ func createSession(tb testing.TB) *Session {
 	cluster.CQLVersion = *flagCQL
 	cluster.CQLVersion = *flagCQL
 	cluster.Timeout = 5 * time.Second
 	cluster.Timeout = 5 * time.Second
 	cluster.Consistency = Quorum
 	cluster.Consistency = Quorum
-	cluster.RetryPolicy.NumRetries = 10
+	cluster.RetryPolicy.NumRetries = *flagRetry
 
 
 	initOnce.Do(func() {
 	initOnce.Do(func() {
 		session, err := cluster.CreateSession()
 		session, err := cluster.CreateSession()