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(mojaloop/#2801): add fulfil timestamp validation and more error handling #916

Merged
merged 24 commits into from
Aug 15, 2022

Conversation

kleyow
Copy link
Contributor

@kleyow kleyow commented Aug 11, 2022

feat(mojaloop/#2801): add fulfil timestamp validation and more error handling - mojaloop/project#2801

  • Port timestamp validation logic that was previously in the bulk-api-adapter
  • Add fulfil handler logic to invalidate individualTransfers in a bulkTransfer
  • Update bulk-processsing handler to handle new validation failure state

@kleyow kleyow marked this pull request as ready for review August 11, 2022 15:09
@@ -18,6 +18,7 @@
"CREATE_RETRY_INTERVAL_MILLIS": 200,
"DEBUG": false
},
"MAX_FULFIL_TIMEOUT_DURATION_SECONDS": 300,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is a breaking change right?

I.e. What is the impact if we do not provide the MAX_FULFIL_TIMEOUT_DURATION_SECONDS config either via default.json or env file?

Copy link
Contributor Author

@kleyow kleyow Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a default timeout that it will default to https://github.com/mojaloop/central-ledger/pull/916/files#diff-b69d6bde1ed95b38264df8b79c66099602625f0eb541d4e98001baed223096d7R213 so it should work without specifying it in the config or env.

@kleyow kleyow changed the title feat: add fulfil timestamp validation and more error handling feat(mojaloop/#2801): add fulfil timestamp validation and more error handling Aug 12, 2022
return { isValid, reasons }
}

const validateCompletedTimestamp = (payload) => {
const maxLag = (Config.MAX_FULFIL_TIMEOUT_DURATION_SECONDS || defaultLagSeconds) * 1000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not be better to have the default values set in the config.js instead of here?

@@ -3,6 +3,7 @@ const RC = require('rc')('CLEDG', require('../../config/default.json'))
module.exports = {
HOSTNAME: RC.HOSTNAME.replace(/\/$/, ''),
PORT: RC.PORT,
MAX_FULFIL_TIMEOUT_DURATION_SECONDS: RC.MAX_FULFIL_TIMEOUT_DURATION_SECONDS,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I.e. I feel that it would be better to have the default value set here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It's better. done.

Copy link
Member

@mdebarros mdebarros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but minor comment for you to address.

Copy link
Member

@mdebarros mdebarros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@kleyow kleyow merged commit 336a0a2 into master Aug 15, 2022
@kleyow kleyow deleted the fix/handle-timeout branch August 15, 2022 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants