@@ -68,23 +68,23 @@ export const resolvePoolSelector = (
6868 | { pool : string ; type : 'explicit' }
6969 | { type : 'auto' ; ip_version ?: IpVersion | null }
7070 | undefined ,
71- poolType ?: IpPoolType
71+ poolType : IpPoolType ,
72+ siloId : string = defaultSilo . id
7273) => {
7374 if ( poolSelector ?. type === 'explicit' ) {
7475 return lookup . ipPool ( { pool : poolSelector . pool } )
7576 }
7677
7778 // For 'auto' type, find the default pool for the specified IP version and pool type
78- const silo = lookup . silo ( { silo : defaultSilo . id } )
79+ const silo = lookup . silo ( { silo : siloId } )
7980 const links = db . ipPoolSilos . filter ( ( ips ) => ips . silo_id === silo . id && ips . is_default )
8081
8182 // Filter candidate pools by both IP version and pool type
8283 const candidateLinks = links . filter ( ( ips ) => {
8384 const pool = db . ipPools . find ( ( p ) => p . id === ips . ip_pool_id )
8485 if ( ! pool ) return false
8586
86- // If poolType specified, filter by it
87- if ( poolType && pool . pool_type !== poolType ) return false
87+ if ( pool . pool_type !== poolType ) return false
8888
8989 // If IP version specified, filter by it
9090 if ( poolSelector ?. ip_version && pool . ip_version !== poolSelector . ip_version ) {
@@ -106,9 +106,8 @@ export const resolvePoolSelector = (
106106
107107 const link = candidateLinks [ 0 ]
108108 if ( ! link ) {
109- const typeStr = poolType ? ` ${ poolType } ` : ''
110109 const versionStr = poolSelector ?. ip_version ? ` ${ poolSelector . ip_version } ` : ''
111- throw notFoundErr ( `default${ typeStr } ${ versionStr } pool for silo '${ defaultSilo . id } '` )
110+ throw notFoundErr ( `default ${ poolType } ${ versionStr } pool for silo '${ siloId } '` )
112111 }
113112 return lookupById ( db . ipPools , link . ip_pool_id )
114113}
0 commit comments