gemcap-be-common 1.3.107 → 1.3.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.3.107",
3
+ "version": "1.3.109",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -266,12 +266,9 @@ class LoanTransactionsService {
266
266
  earliestTransactionIds.set(productId, { transactionId, date });
267
267
  }
268
268
  });
269
- const earliestTransactionIdsList = Array
270
- .from(earliestTransactionIds.values())
271
- .map((entry) => entry.transactionId);
272
- await Promise.all(earliestTransactionIdsList.map(async (transactionId) => {
273
- setTimeout(async () => await this.recalculateBalanceQueued(null, transactionId));
274
- }));
269
+ for (const [productId, values] of earliestTransactionIds) {
270
+ await this.recalculateBalanceQueued(productId, values.transactionId);
271
+ }
275
272
  }
276
273
  async normalizeLoanTransaction(transaction, userId) {
277
274
  transaction.effectiveDate = await this.calculateEffectiveDate(transaction);
@@ -468,7 +465,10 @@ class LoanTransactionsService {
468
465
  await recalcFloatedBalance();
469
466
  }
470
467
  async recalculateBalanceQueued(productId, transactionId) {
471
- await this.mainQueueService.sendTaskToQueue({ data: { productId, transactionId }, pattern: 'recalc#BALANCES' }, 'goat_legacy_queue');
468
+ await this.mainQueueService.sendTaskToQueue({
469
+ data: { productId, transactionId },
470
+ pattern: 'recalc#BALANCES',
471
+ }, 'goat_recalc');
472
472
  }
473
473
  async recalculateBalance(transactionId) {
474
474
  const startTransaction = await LoanTransaction_model_1.LoanTransaction.findById(transactionId).lean();
@@ -319,13 +319,9 @@ export class LoanTransactionsService {
319
319
  }
320
320
  });
321
321
 
322
- const earliestTransactionIdsList = Array
323
- .from(earliestTransactionIds.values())
324
- .map((entry) => entry.transactionId);
325
-
326
- await Promise.all(earliestTransactionIdsList.map(async (transactionId) => {
327
- setTimeout(async () => await this.recalculateBalanceQueued(null, transactionId));
328
- }));
322
+ for (const [productId, values] of earliestTransactionIds) {
323
+ await this.recalculateBalanceQueued(productId, values.transactionId);
324
+ }
329
325
  }
330
326
 
331
327
  async normalizeLoanTransaction(transaction: ILoanTransactionDoc, userId: string) {
@@ -534,7 +530,10 @@ export class LoanTransactionsService {
534
530
  }
535
531
 
536
532
  async recalculateBalanceQueued(productId: string, transactionId: string) {
537
- await this.mainQueueService.sendTaskToQueue({ data: { productId, transactionId }, pattern: 'recalc#BALANCES' }, 'goat_legacy_queue');
533
+ await this.mainQueueService.sendTaskToQueue({
534
+ data: { productId, transactionId },
535
+ pattern: 'recalc#BALANCES',
536
+ }, 'goat_recalc');
538
537
  }
539
538
 
540
539
  async recalculateBalance(transactionId: string) {