Skip to content

Commit

Permalink
Merge pull request #262 from credebl/upload-csv-issue
Browse files Browse the repository at this point in the history
fix: added CacheModule in app.module
  • Loading branch information
nishad-ayanworks authored Nov 15, 2023
2 parents 7a0b073 + e17c8f0 commit 8ee82c9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
3 changes: 3 additions & 0 deletions apps/api-gateway/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -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,
Expand Down
32 changes: 18 additions & 14 deletions apps/issuance/src/issuance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 8ee82c9

Please sign in to comment.