mirror of
https://github.com/Alvin-Zilverstand/nginx-proxy-manager.git
synced 2026-11-28 00:47:54 +01:00
Change access list client insert to synchronous to ensure order preserved
This commit is contained in:
1 parent
84fb2729af
commit
1635e512c7
1 file changed
+18
-29
@@ -48,20 +48,17 @@ const internalAccessList = {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Clients
|
|
||||||
data.clients?.map((client) => {
|
|
||||||
promises.push(
|
|
||||||
accessListClientModel.query().insert({
|
|
||||||
access_list_id: row.id,
|
|
||||||
address: client.address,
|
|
||||||
directive: client.directive,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
|
|
||||||
|
// Clients
|
||||||
|
for (const client of data.clients ?? []) {
|
||||||
|
await accessListClientModel.query().insert({
|
||||||
|
access_list_id: row.id,
|
||||||
|
address: client.address,
|
||||||
|
directive: client.directive,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// re-fetch with expansions
|
// re-fetch with expansions
|
||||||
const freshRow = await internalAccessList.get(
|
const freshRow = await internalAccessList.get(
|
||||||
access,
|
access,
|
||||||
@@ -154,25 +151,17 @@ const internalAccessList = {
|
|||||||
|
|
||||||
// Check for clients and add/update/remove them
|
// Check for clients and add/update/remove them
|
||||||
if (typeof data.clients !== "undefined" && data.clients) {
|
if (typeof data.clients !== "undefined" && data.clients) {
|
||||||
const clientPromises = [];
|
|
||||||
data.clients.map((client) => {
|
|
||||||
if (client.address) {
|
|
||||||
clientPromises.push(
|
|
||||||
accessListClientModel.query().insert({
|
|
||||||
access_list_id: data.id,
|
|
||||||
address: client.address,
|
|
||||||
directive: client.directive,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
const query = accessListClientModel.query().delete().where("access_list_id", data.id);
|
const query = accessListClientModel.query().delete().where("access_list_id", data.id);
|
||||||
await query;
|
await query;
|
||||||
// Add new clitens
|
|
||||||
if (clientPromises.length) {
|
for (const client of data.clients) {
|
||||||
await Promise.all(clientPromises);
|
if (client.address) {
|
||||||
|
await accessListClientModel.query().insert({
|
||||||
|
access_list_id: data.id,
|
||||||
|
address: client.address,
|
||||||
|
directive: client.directive,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user