Pick client endpoint as part of the transation

This commit is contained in:
Owen
2025-12-08 21:37:17 -05:00
parent 0a9b19ecfc
commit a306aa971b
2 changed files with 3 additions and 2 deletions

View File

@@ -166,7 +166,7 @@ export async function calculateUserClientsForOrgs(
];
// Get next available subnet
const newSubnet = await getNextAvailableClientSubnet(orgId);
const newSubnet = await getNextAvailableClientSubnet(orgId, transaction);
if (!newSubnet) {
logger.warn(
`Skipping org ${orgId} for OLM ${olm.olmId} (user ${userId}): no available subnet found`

View File

@@ -244,7 +244,8 @@ export function isIpInCidr(ip: string, cidr: string): boolean {
}
export async function getNextAvailableClientSubnet(
orgId: string
orgId: string,
transaction: Transaction | typeof db = db
): Promise<string> {
const [org] = await db.select().from(orgs).where(eq(orgs.orgId, orgId));