Fix non awaited promises (#88)
This commit is contained in:
@@ -190,6 +190,10 @@ Resources:
|
|||||||
- 'comprehend:DetectDominantLanguage'
|
- 'comprehend:DetectDominantLanguage'
|
||||||
- 'translate:TranslateText'
|
- 'translate:TranslateText'
|
||||||
Resource: '*'
|
Resource: '*'
|
||||||
|
- Effect: Allow
|
||||||
|
Action:
|
||||||
|
- 'sqs:SendMessage'
|
||||||
|
Resource: !Sub arn:aws:sqs:eu-west-1:954747537408:photowall-bernard-${EnvironmentName}
|
||||||
|
|
||||||
# A role for the containers
|
# A role for the containers
|
||||||
TaskRole:
|
TaskRole:
|
||||||
|
|||||||
@@ -407,22 +407,25 @@ export class ProductAPI extends BaseSQLDataSource {
|
|||||||
productId: number,
|
productId: number,
|
||||||
info: ProductInfoInput,
|
info: ProductInfoInput,
|
||||||
): Promise<any[]> {
|
): Promise<any[]> {
|
||||||
|
const promises = [];
|
||||||
|
|
||||||
// Check path and insert new unique path if taken
|
// Check path and insert new unique path if taken
|
||||||
const uniquePath = await this.getUniqueProductPath(info.path, productId);
|
const uniquePath = await this.getUniqueProductPath(info.path, productId);
|
||||||
const oldProd = await this.getProduct(productId);
|
const oldProd = await this.getProduct(productId);
|
||||||
if (oldProd.path !== uniquePath) {
|
if (oldProd.path !== uniquePath) {
|
||||||
sendPathChangedCmd(oldProd.path, uniquePath);
|
const promise = sendPathChangedCmd(oldProd.path, uniquePath);
|
||||||
|
promises.push(promise);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldProd.fields.name !== info.name) {
|
if (oldProd.fields.name !== info.name) {
|
||||||
await this.textsApi.translateProductName(
|
const promise = this.textsApi.translateProductName(
|
||||||
info.name,
|
info.name,
|
||||||
oldProd.path,
|
oldProd.path,
|
||||||
uniquePath,
|
uniquePath,
|
||||||
);
|
);
|
||||||
|
promises.push(promise);
|
||||||
}
|
}
|
||||||
|
|
||||||
const promises = [];
|
|
||||||
promises.push(
|
promises.push(
|
||||||
this.knex
|
this.knex
|
||||||
.table('product-products')
|
.table('product-products')
|
||||||
|
|||||||
Reference in New Issue
Block a user