File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
Tests/CassandraClientTests Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,10 @@ extension CassandraClient {
81
81
if let consistency = options. consistency {
82
82
try checkResult { cass_statement_set_consistency ( self . rawPointer, consistency. cassConsistency) }
83
83
}
84
+
85
+ if let requestTimeout = options. requestTimeout {
86
+ try checkResult { cass_statement_set_request_timeout ( self . rawPointer, requestTimeout) }
87
+ }
84
88
}
85
89
86
90
func setPagingSize( _ pagingSize: Int32 ) throws {
@@ -118,13 +122,21 @@ extension CassandraClient {
118
122
public struct Options : CustomStringConvertible {
119
123
/// Sets the statement's consistency level. Default is `.localOne`.
120
124
public var consistency : CassandraClient . Consistency ?
125
+ /// Sets the statement's request timeout in milliseconds. Default is `CASS_UINT64_MAX`
126
+ public var requestTimeout : UInt64 ?
121
127
122
- public init ( consistency: CassandraClient . Consistency ? = . none ) {
128
+ public init ( consistency: CassandraClient . Consistency ? = nil , requestTimeout : UInt64 ? = nil ) {
123
129
self . consistency = consistency
130
+ self . requestTimeout = requestTimeout
124
131
}
125
132
126
133
public var description : String {
127
- " Options { consistency: \( String ( describing: self . consistency) ) } "
134
+ """
135
+ Options {
136
+ consistency: \( String ( describing: self . consistency) ) ,
137
+ requestTimeout: \( String ( describing: self . requestTimeout) )
138
+ }
139
+ """
128
140
}
129
141
}
130
142
}
Original file line number Diff line number Diff line change @@ -194,8 +194,7 @@ final class Tests: XCTestCase {
194
194
let tableName = " test_ \( DispatchTime . now ( ) . uptimeNanoseconds) "
195
195
XCTAssertNoThrow ( try self . cassandraClient. run ( " create table \( tableName) (id int primary key, data text); " ) . wait ( ) )
196
196
197
- var options = CassandraClient . Statement. Options ( )
198
- options. consistency = . localQuorum
197
+ let options = CassandraClient . Statement. Options ( consistency: . localQuorum)
199
198
200
199
let count = Int . random ( in: 5000 ... 6000 )
201
200
var futures = [ EventLoopFuture < Void > ] ( )
You can’t perform that action at this time.
0 commit comments