Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: async queue implementation #755

Merged
merged 6 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/issuance/src/issuance.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ export class BulkIssuanceProcessor {
`Processing job ${job.id} of type ${job.name} with data ${JSON.stringify(job.data)}...`
);

await this.issuanceService.processIssuanceData(job.data);
this.issuanceService.processIssuanceData(job.data);
}
}
6 changes: 4 additions & 2 deletions apps/issuance/src/issuance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { sendEmail } from '@credebl/common/send-grid-helper-file';
@Injectable()
export class IssuanceService {
private readonly logger = new Logger('IssueCredentialService');
private counter = 0;
private processedJobsCounters: Record<string, number> = {};
constructor(
@Inject('NATS_CLIENT') private readonly issuanceServiceProxy: ClientProxy,
Expand Down Expand Up @@ -694,8 +695,9 @@ async sendEmailForCredentialOffer(sendEmailCredentialOffer: SendEmailCredentialO
disposition: 'attachment'
}
];
const isEmailSent = await sendEmail(this.emailData);
this.logger.log(`isEmailSent ::: ${JSON.stringify(isEmailSent)}`);
const isEmailSent = await sendEmail(this.emailData);
this.logger.log(`isEmailSent ::: ${JSON.stringify(isEmailSent)}-${this.counter}`);
this.counter++;
if (!isEmailSent) {
errors.push(new InternalServerErrorException(ResponseMessages.issuance.error.emailSend));
return false;
Expand Down
2 changes: 1 addition & 1 deletion libs/common/src/response-messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export const ResponseMessages = {
invalidtemplateId: 'Invalid template id.',
invalidIdentifier: 'Invalid Identifier',
exportFile: 'An error occurred during CSV export.',
emailColumn: '1st column of the file should always be email.',
emailColumn: '1st column of the file should always be email_identifier.',
attributeNumber: 'Number of supplied values is different from the number of schema attributes.',
mismatchedAttributes: 'Schema attributes are mismatched in the file header.',
fileDetailsNotFound: 'File details not found.',
Expand Down