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