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

fix: avoid 2 extra db requests #1054

Draft
wants to merge 1 commit into
base: feat/fx-impl
Choose a base branch
from

Conversation

kalinkrustev
Copy link
Contributor

No description provided.

Copy link

sonarcloud bot commented Jun 18, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
22.2% Duplication on New Code

See analysis details on SonarCloud

Comment on lines -310 to +312
const cyrilOutput = await this.cyril.processFxFulfilMessage(transfer.commitRequestId, payload)
if (!transfer.fxWatchListId) {
throw new Error(`Commit request ID ${transfer.commitRequestId} not found in watch list`)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we still have a function in cyril 'processFxFulfilMessage' for this check? I mean. you can remove the call 'getAllDetailsByCommitRequestId' in that function, but I would recommend the queries (getItemInWatchListByCommitRequestId) on watchlist in the cyril functions instead of having a join in other place. Because the watchlist logic may change and I wouldn't suggest merging watchList in the places other than cyril. I know it's additional query but I hope it will not impact performance that much compared to left join.

@@ -90,9 +90,11 @@ const getAllDetailsByCommitRequestId = async (commitRequestId) => {
.leftJoin('fxTransferStateChange AS tsc', 'tsc.commitRequestId', 'fxTransfer.commitRequestId')
.leftJoin('transferState AS ts', 'ts.transferStateId', 'tsc.transferStateId')
.leftJoin('fxTransferFulfilment AS tf', 'tf.commitRequestId', 'fxTransfer.commitRequestId')
.leftJoin('fxWatchList AS wl', 'wl.commitRequestId', 'fxTransfer.commitRequestId')
Copy link
Contributor

Choose a reason for hiding this comment

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

Please see my above comment.

@kalinkrustev kalinkrustev marked this pull request as draft June 18, 2024 09:02
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