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
[backend] Fix parse_exception: request body is required (#6552) #6788
Conversation
7494cbb
to
3396f5d
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6788 +/- ##
=======================================
Coverage 68.06% 68.06%
=======================================
Files 538 538
Lines 65801 65803 +2
Branches 5578 5578
=======================================
+ Hits 44786 44788 +2
Misses 21015 21015 ☔ View full report in Codecov by Sentry. |
@@ -3162,7 +3162,9 @@ const elRemoveRelationConnection = async (context, user, elementsImpact) => { | |||
}); | |||
}); | |||
const bodyUpdate = R.flatten(bodyUpdateRaw); | |||
await elBulk({ refresh: true, timeout: BULK_TIMEOUT, body: bodyUpdate }); | |||
if (bodyUpdate.length > 0) { |
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 investigate why we don't have a body rather ?
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 didn't have time to investigate in details, I guessed the relationships we try to delete have already been deleted. But if you think we should take more time to fix this issue, let me know.
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.
It's not about time spent on task it's about knowing what we are fixing.
I'm always afraid of that kind of fix because it might be hidding a real root cause that we will keep having.
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 understand, but in this code, we have no way of knowing that we will find all the relationships we want to delete in the database. We have the same condition in elIndexElements :
if (bodyUpdate.length > 0) {
const bulkPromise = elBulk({ refresh: true, timeout: BULK_TIMEOUT, body: bodyUpdate });
await Promise.all([bulkPromise]);
}
What do you think @richard-julien ? did I miss something about this code ?
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 like we have a condition when the list can be empty
if (isEmptyField(fromIndex)) { // No need to clean up the connections if the target is already deleted.
return updates;
}
If i remember well is a condition to optimize the number of operation to execute, so can be empty in some conditions
Im ok with the fix.
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 after reading all comments in the PR.
Proposed changes
Related issues
Issue not reproduced locally
Checklist