-
Notifications
You must be signed in to change notification settings - Fork 14
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
#4076 - Queue Monitoring - Schedulers Refactor (Fed Restrictions and Receipts) #4135
#4076 - Queue Monitoring - Schedulers Refactor (Fed Restrictions and Receipts) #4135
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍 Thanks for refactoring this part of the schedulers.
processSummary: ProcessSummary, | ||
): Promise<string> { | ||
await this.disbursementReceiptProcessingService.process(processSummary); | ||
return "Completed disbursement receipts integration."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
...esdc-integration/disbursement-receipt-integration/disbursement-receipt.processing.service.ts
Outdated
Show resolved
Hide resolved
this.logger.error(error); | ||
this.logger.error(logMessage, error); | ||
processSummary.error(logMessage, error); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the return here will modify the existing behavior. i.e. if there is an error processing one or more detail record, then we skip the those one and process others. With return it will abort at first failure.
Is there a reason for making this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is changing the behavior and keeping the file on error. I will remove to short the conversation and move on with the PR but I do not recall why we chose this direction. Do you remember? If not, I will start a separate conversation with biz.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we chose this direction as each receipt record can be considered independently and processed ignoring one or more records with data errors or other errors. But I would say we should check the direction with business.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we talked, I will check with the business and consider if we should generate the report or not.
For this ticket and this PR, I will keeping the existing behavior as suggested.
...esdc-integration/disbursement-receipt-integration/disbursement-receipt.processing.service.ts
Outdated
Show resolved
Hide resolved
const errorMessage = | ||
"Error while generating provincial daily disbursement CSV report file."; | ||
this.logger.error(errorMessage, error); | ||
processSummary.error(errorMessage, error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the retry happen when the report generation alone fail? - let me know if I am missing something here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason not to retry? The import should be able to be executed twice and the report generation is part of the process, hence if it fails it would not need manual intervention.
pleas let me know if we need to discuss this further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed, let's keep the retry to allow the report to be sent and the job auto-recover avoiding the manual intervention.
let downloadResult: FedRestrictionFileRecord[]; | ||
processSummary: ProcessSummary, | ||
): Promise<void> { | ||
processSummary.info(`Processing file ${remoteFilePath}.`); | ||
this.logger.log(`Starting download of file ${remoteFilePath}.`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#4135 (comment) also at line 109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear, I did not remove them all because they were serving different purposes and I did not consider it as part of the immediate refactor. I can explain further if needed. I will remove this also.
@@ -139,7 +132,7 @@ export class FedRestrictionProcessingService { | |||
const invalidDataMessage = restriction.getInvalidDataMessage(); | |||
if (invalidDataMessage) { | |||
const errorMessage = `Found record with invalid data at line number ${restriction.lineNumber}: ${invalidDataMessage}`; | |||
result.errorsSummary.push(errorMessage); | |||
processSummary.error(errorMessage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we use processSummary.warn
as we are not expecting retry for invalid data in the file.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will trigger a different conversation. Yes, we can change to warn
to avoid the retry, but it also should alert the Ministry in some way. I will change to a warn to move on and discuss further with biz.
* @returns true if the log message was found. otherwise false. | ||
*/ | ||
containLogMessage(logMessage: string): boolean { | ||
return this.logMessages.some((message) => message.endsWith(logMessage)); | ||
return this.logMessages.some((message) => message.includes(logMessage)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Good Job @andrewsignori-aot. Added some comments. Few of them were clarifications too. |
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes. Looks good 👍
disbursement-receipts-file-integration
andfederal-restrictions-integration
.BaseQueue
is already logging similar start/end logs.E2E
containLogMessages
changesTo allow the below check to happen the method
containLogMessages
was changed to check if the string "contains" a value instead of "endsWith" it. TheendsWith
was used to have a more precise check and remove the log initial information (e.g. context and date). Using the "contains" will still give enough assertion precision and allow inspecting errors currently serialized to a JSON.