Add comment to explain why we resolve the promises sequentially

This commit is contained in:
Marliana Lara 2021-06-24 15:32:33 -04:00 committed by Shane McDonald
parent 162ea776fd
commit f541fe9904
No known key found for this signature in database
GPG Key ID: 6F374AF6E9EB9374
4 changed files with 4 additions and 0 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}