@@ -30,6 +30,7 @@ actor DatabasePool {
3030 self . connectionDetails = . init( index: index)
3131 }
3232
33+ var host : String { connectionDetails. host }
3334 var port : Int { connectionDetails. port }
3435 }
3536
@@ -125,7 +126,7 @@ actor DatabasePool {
125126 // We don't have docker available in CI to probe for running dbs.
126127 // Instead, we have a hard-coded list of dbs we launch in the GH workflow
127128 // file and correspondingly, we hard-code their ports here.
128- return ( 0 ..< 8 ) . map ( Database . init ( index: ) )
129+ return ( 0 ..< Environment . databasePoolSize ) . map ( Database . init ( index: ) )
129130 } else {
130131 let stdout = try await ShellOut . shellOut ( to: . getContainerNames) . stdout
131132 return stdout
@@ -228,7 +229,7 @@ extension DatabasePool.Database {
228229 do { // Use autoMigrate to spin up the schema
229230 let app = try await Application . make ( environment)
230231 app. logger = . init( label: " noop " ) { _ in SwiftLogNoOpLogHandler ( ) }
231- try await configure ( app, databasePort: connectionDetails. port)
232+ try await configure ( app, databaseHost : connectionDetails . host , databasePort: connectionDetails. port)
232233 try await app. autoMigrate ( )
233234 try await app. asyncShutdown ( )
234235 }
@@ -282,7 +283,6 @@ private func connect(to databaseName: String, details: DatabasePool.Database.Con
282283 database: databaseName,
283284 tls: . disable
284285 )
285-
286286 return . init( configuration: config)
287287}
288288
@@ -293,12 +293,11 @@ private func _withDatabase(_ databaseName: String,
293293 _ query: @Sendable @escaping ( PostgresClient) async throws -> Void ) async throws {
294294 let client = connect ( to: databaseName, details: details)
295295 try await run ( timeout: timeout) {
296- #warning("This looks weird, review it")
297296 try await withThrowingTaskGroup { taskGroup in
298297 taskGroup. addTask { await client. run ( ) }
299- taskGroup . addTask {
300- try await query ( client)
301- }
298+
299+ taskGroup . addTask { try await query ( client) }
300+
302301 try await taskGroup. next ( )
303302 taskGroup. cancelAll ( )
304303 }
0 commit comments