Repository navigation
Conversation
Fixes OpenSignLabs#1997 Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
|
@alfonsodg is attempting to deploy a commit to the prafull 's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
🟡 Changes recommended
Deep pagination loses results, the Owner column loses populated data, and searched reports bypass the optimization.
3 open issues
What changed in this PR
This PR aims to speed up the Completed report by separating creator and signer queries and reducing populated relations.
Changes:
- Runs creator and signer queries concurrently, then deduplicates, sorts, and paginates their combined results.
- Omits the tenant relation from Completed report includes while retaining existing includes for other reports.
| File | Description |
|---|---|
apps/OpenSignServer/cloud/parsefunction/getReport.js |
Adds split-query handling and conditional relation includes for Completed reports. |
Review effort: Balanced
| const include = 'AuditTrail.UserPtr,Placeholders.signerPtr,ExtUserPtr.TenantId'; | ||
| const isCompletedReport = reportId === 'kQUoW4hUXz'; | ||
| const include = isCompletedReport | ||
| ? 'AuditTrail.UserPtr,Placeholders.signerPtr' |
Comment on lines
+96
to
+97
| if (isCompletedReport && paramsObj && paramsObj.$or) { | ||
| const { $or, ...baseWhere } = paramsObj; |
| keys: json.keys || [], | ||
| orderBy, | ||
| skip: 0, | ||
| limit: Number(limit) + Number(skip) || 100, |
3 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
The "Completed" tab became slow as the number of completed documents grew. The
query combined a direct
CreatedBypredicate with aSigners$inQueryin asingle
$or, which MongoDB cannot serve from a single index, so it fell backto collection scans. It also populated the tenant relation, which the completed
report does not use.
Affected files
apps/OpenSignServer/cloud/parsefunction/getReport.jsFix
queries and merges the results.
Acceptance criteria