mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-14 08:19:51 +02:00
Pull the listing out of the queue
This commit is contained in:
@@ -162,13 +162,7 @@ export async function getClientSiteResourceAccess(
|
|||||||
export async function rebuildClientAssociationsFromSiteResource(
|
export async function rebuildClientAssociationsFromSiteResource(
|
||||||
siteResource: SiteResource,
|
siteResource: SiteResource,
|
||||||
trx: Transaction | typeof db = db
|
trx: Transaction | typeof db = db
|
||||||
): Promise<{
|
) {
|
||||||
mergedAllClients: {
|
|
||||||
clientId: number;
|
|
||||||
pubKey: string | null;
|
|
||||||
subnet: string | null;
|
|
||||||
}[];
|
|
||||||
}> {
|
|
||||||
try {
|
try {
|
||||||
return await lockManager.withLock(
|
return await lockManager.withLock(
|
||||||
`rebuild-client-associations:site-resource:${siteResource.siteResourceId}`,
|
`rebuild-client-associations:site-resource:${siteResource.siteResourceId}`,
|
||||||
|
|||||||
@@ -28,7 +28,10 @@ import {
|
|||||||
isIpInCidr,
|
isIpInCidr,
|
||||||
portRangeStringSchema
|
portRangeStringSchema
|
||||||
} from "@server/lib/ip";
|
} from "@server/lib/ip";
|
||||||
import { rebuildClientAssociationsFromSiteResource } from "@server/lib/rebuildClientAssociations";
|
import {
|
||||||
|
getClientSiteResourceAccess,
|
||||||
|
rebuildClientAssociationsFromSiteResource
|
||||||
|
} from "@server/lib/rebuildClientAssociations";
|
||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
import { NextFunction, Request, Response } from "express";
|
import { NextFunction, Request, Response } from "express";
|
||||||
@@ -846,9 +849,14 @@ export async function handleMessagingForUpdatedSiteResource(
|
|||||||
updatedSiteResource
|
updatedSiteResource
|
||||||
);
|
);
|
||||||
|
|
||||||
const { mergedAllClients } =
|
await rebuildClientAssociationsFromSiteResource(
|
||||||
await rebuildClientAssociationsFromSiteResource(
|
existingSiteResource || updatedSiteResource, // we want to rebuild based on the existing resource then we will apply the change to the destination below
|
||||||
existingSiteResource || updatedSiteResource, // we want to rebuild based on the existing resource then we will apply the change to the destination below
|
trx
|
||||||
|
);
|
||||||
|
|
||||||
|
const { sitesList, mergedAllClients, mergedAllClientIds } =
|
||||||
|
await getClientSiteResourceAccess(
|
||||||
|
existingSiteResource || updatedSiteResource,
|
||||||
trx
|
trx
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user