diff --git a/apps/api-gateway/src/app.module.ts b/apps/api-gateway/src/app.module.ts index 00b907bbf..48ca89ea5 100644 --- a/apps/api-gateway/src/app.module.ts +++ b/apps/api-gateway/src/app.module.ts @@ -21,6 +21,8 @@ import { UserModule } from './user/user.module'; import { ConnectionModule } from './connection/connection.module'; import { EcosystemModule } from './ecosystem/ecosystem.module'; import { BullModule } from '@nestjs/bull'; +import { CacheModule } from '@nestjs/cache-manager'; +import * as redisStore from 'cache-manager-redis-store'; @Module({ imports: [ @@ -44,6 +46,7 @@ import { BullModule } from '@nestjs/bull'; ConnectionModule, IssuanceModule, EcosystemModule, + CacheModule.register({ store: redisStore, host: process.env.REDIS_HOST, port: process.env.REDIS_PORT }), BullModule.forRoot({ redis: { host: process.env.REDIS_HOST, diff --git a/apps/issuance/src/issuance.service.ts b/apps/issuance/src/issuance.service.ts index c8891e31e..cb209020e 100644 --- a/apps/issuance/src/issuance.service.ts +++ b/apps/issuance/src/issuance.service.ts @@ -709,21 +709,25 @@ export class IssuanceService { this.logger.log(`respFileUpload----${JSON.stringify(respFileUpload)}`); await parsedData.forEach(async (element, index) => { - this.logger.log(`element----${JSON.stringify(index)}`); this.logger.log(`element----${JSON.stringify(element)}`); - this.bulkIssuanceQueue.add( - 'issue-credential', - { - data: element, - fileUploadId: respFileUpload.id, - cacheId: requestId, - credentialDefinitionId: parsedPrimeDetails.credentialDefinitionId, - schemaLedgerId: parsedPrimeDetails.schemaLedgerId, - orgId, - isLastData: index === parsedData.length - 1 - }, - { delay: 5000 } - ); + try { + this.bulkIssuanceQueue.add( + 'issue-credential', + { + data: element, + fileUploadId: respFileUpload.id, + cacheId: requestId, + credentialDefinitionId: parsedPrimeDetails.credentialDefinitionId, + schemaLedgerId: parsedPrimeDetails.schemaLedgerId, + orgId, + isLastData: index === parsedData.length - 1 + }, + { delay: 5000 } + ); + } catch (error) { + this.logger.error('Error adding item to the queue:', error); + } + }); return 'Process initiated for bulk issuance';