mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 15:36:04 -03:30
Add comment to explain why we resolve the promises sequentially
This commit is contained in:
committed by
Shane McDonald
parent
162ea776fd
commit
f541fe9904
@@ -30,6 +30,7 @@ const InstanceGroupsMixin = parent =>
|
|||||||
|
|
||||||
async orderInstanceGroups(resourceId, current, original) {
|
async orderInstanceGroups(resourceId, current, original) {
|
||||||
/* eslint-disable no-await-in-loop, no-restricted-syntax */
|
/* eslint-disable no-await-in-loop, no-restricted-syntax */
|
||||||
|
// Resolve Promises sequentially to maintain order and avoid race condition
|
||||||
if (!isEqual(current, original)) {
|
if (!isEqual(current, original)) {
|
||||||
for (const group of original) {
|
for (const group of original) {
|
||||||
await this.disassociateInstanceGroup(resourceId, group.id);
|
await this.disassociateInstanceGroup(resourceId, group.id);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ function InventoryAdd() {
|
|||||||
...remainingValues,
|
...remainingValues,
|
||||||
});
|
});
|
||||||
/* eslint-disable no-await-in-loop, no-restricted-syntax */
|
/* eslint-disable no-await-in-loop, no-restricted-syntax */
|
||||||
|
// Resolve Promises sequentially to maintain order and avoid race condition
|
||||||
for (const group of instanceGroups) {
|
for (const group of instanceGroups) {
|
||||||
await InventoriesAPI.associateInstanceGroup(inventoryId, group.id);
|
await InventoriesAPI.associateInstanceGroup(inventoryId, group.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ function SmartInventoryAdd() {
|
|||||||
} = await InventoriesAPI.create(values);
|
} = await InventoriesAPI.create(values);
|
||||||
|
|
||||||
/* eslint-disable no-await-in-loop, no-restricted-syntax */
|
/* eslint-disable no-await-in-loop, no-restricted-syntax */
|
||||||
|
// Resolve Promises sequentially to maintain order and avoid race condition
|
||||||
for (const group of groupsToAssociate) {
|
for (const group of groupsToAssociate) {
|
||||||
await InventoriesAPI.associateInstanceGroup(invId, group.id);
|
await InventoriesAPI.associateInstanceGroup(invId, group.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ function JobTemplateAdd() {
|
|||||||
|
|
||||||
async function submitInstanceGroups(templateId, addedGroups = []) {
|
async function submitInstanceGroups(templateId, addedGroups = []) {
|
||||||
/* eslint-disable no-await-in-loop, no-restricted-syntax */
|
/* eslint-disable no-await-in-loop, no-restricted-syntax */
|
||||||
|
// Resolve Promises sequentially to maintain order and avoid race condition
|
||||||
for (const group of addedGroups) {
|
for (const group of addedGroups) {
|
||||||
await JobTemplatesAPI.associateInstanceGroup(templateId, group.id);
|
await JobTemplatesAPI.associateInstanceGroup(templateId, group.id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user