@@ -167,7 +167,7 @@ public struct CommandSucceededEvent: MongoSwiftEvent, CommandEventProtocol {
167167 }
168168
169169 /// The execution time of the event, in microseconds.
170- public let duration : Int64
170+ public let duration : Int
171171
172172 /// The command reply.
173173 public let reply : Document
@@ -186,7 +186,8 @@ public struct CommandSucceededEvent: MongoSwiftEvent, CommandEventProtocol {
186186 public let serverAddress : Address
187187
188188 fileprivate init ( mongocEvent: MongocCommandSucceededEvent ) {
189- self . duration = mongoc_apm_command_succeeded_get_duration ( mongocEvent. ptr)
189+ // TODO: SWIFT-349 add logging to check and warn of unlikely int size issues
190+ self . duration = Int ( mongoc_apm_command_succeeded_get_duration ( mongocEvent. ptr) )
190191 // we have to copy because libmongoc owns the pointer.
191192 self . reply = Document ( copying: mongoc_apm_command_succeeded_get_reply ( mongocEvent. ptr) )
192193 self . commandName = String ( cString: mongoc_apm_command_succeeded_get_command_name ( mongocEvent. ptr) )
@@ -216,7 +217,7 @@ public struct CommandFailedEvent: MongoSwiftEvent, CommandEventProtocol {
216217 }
217218
218219 /// The execution time of the event, in microseconds.
219- public let duration : Int64
220+ public let duration : Int
220221
221222 /// The command name.
222223 public let commandName : String
@@ -235,7 +236,7 @@ public struct CommandFailedEvent: MongoSwiftEvent, CommandEventProtocol {
235236 public let serverAddress : Address
236237
237238 fileprivate init ( mongocEvent: MongocCommandFailedEvent ) {
238- self . duration = mongoc_apm_command_failed_get_duration ( mongocEvent. ptr)
239+ self . duration = Int ( mongoc_apm_command_failed_get_duration ( mongocEvent. ptr) )
239240 self . commandName = String ( cString: mongoc_apm_command_failed_get_command_name ( mongocEvent. ptr) )
240241 var error = bson_error_t ( )
241242 mongoc_apm_command_failed_get_error ( mongocEvent. ptr, & error)
@@ -548,7 +549,7 @@ public struct ServerHeartbeatSucceededEvent: MongoSwiftEvent {
548549 }
549550
550551 /// The execution time of the event, in microseconds.
551- public let duration : Int64
552+ public let duration : Int
552553
553554 /// The command reply.
554555 public let reply : Document
@@ -557,7 +558,7 @@ public struct ServerHeartbeatSucceededEvent: MongoSwiftEvent {
557558 public let serverAddress : Address
558559
559560 fileprivate init ( mongocEvent: MongocServerHeartbeatSucceededEvent ) {
560- self . duration = mongoc_apm_server_heartbeat_succeeded_get_duration ( mongocEvent. ptr)
561+ self . duration = Int ( mongoc_apm_server_heartbeat_succeeded_get_duration ( mongocEvent. ptr) )
561562 // we have to copy because libmongoc owns the pointer.
562563 self . reply = Document ( copying: mongoc_apm_server_heartbeat_succeeded_get_reply ( mongocEvent. ptr) )
563564 self . serverAddress = Address ( mongoc_apm_server_heartbeat_succeeded_get_host ( mongocEvent. ptr) )
@@ -584,7 +585,7 @@ public struct ServerHeartbeatFailedEvent: MongoSwiftEvent {
584585 }
585586
586587 /// The execution time of the event, in microseconds.
587- public let duration : Int64
588+ public let duration : Int
588589
589590 /// The failure.
590591 public let failure : MongoError
@@ -593,7 +594,7 @@ public struct ServerHeartbeatFailedEvent: MongoSwiftEvent {
593594 public let serverAddress : Address
594595
595596 fileprivate init ( mongocEvent: MongocServerHeartbeatFailedEvent ) {
596- self . duration = mongoc_apm_server_heartbeat_failed_get_duration ( mongocEvent. ptr)
597+ self . duration = Int ( mongoc_apm_server_heartbeat_failed_get_duration ( mongocEvent. ptr) )
597598 var error = bson_error_t ( )
598599 mongoc_apm_server_heartbeat_failed_get_error ( mongocEvent. ptr, & error)
599600 self . failure = extractMongoError ( error: error)
0 commit comments