mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-03 01:06:39 +00:00
Pick client endpoint as part of the transation
This commit is contained in:
@@ -166,7 +166,7 @@ export async function calculateUserClientsForOrgs(
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Get next available subnet
|
// Get next available subnet
|
||||||
const newSubnet = await getNextAvailableClientSubnet(orgId);
|
const newSubnet = await getNextAvailableClientSubnet(orgId, transaction);
|
||||||
if (!newSubnet) {
|
if (!newSubnet) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
`Skipping org ${orgId} for OLM ${olm.olmId} (user ${userId}): no available subnet found`
|
`Skipping org ${orgId} for OLM ${olm.olmId} (user ${userId}): no available subnet found`
|
||||||
|
|||||||
@@ -244,7 +244,8 @@ export function isIpInCidr(ip: string, cidr: string): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getNextAvailableClientSubnet(
|
export async function getNextAvailableClientSubnet(
|
||||||
orgId: string
|
orgId: string,
|
||||||
|
transaction: Transaction | typeof db = db
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const [org] = await db.select().from(orgs).where(eq(orgs.orgId, orgId));
|
const [org] = await db.select().from(orgs).where(eq(orgs.orgId, orgId));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user