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(nbstore): new doc sync engine #8918

Open
wants to merge 2 commits into
base: canary
Choose a base branch
from
Open

feat(nbstore): new doc sync engine #8918

wants to merge 2 commits into from

Conversation

EYHN
Copy link
Member

@EYHN EYHN commented Nov 25, 2024

No description provided.

@EYHN EYHN marked this pull request as ready for review November 25, 2024 12:11
Copy link

graphite-app bot commented Nov 25, 2024

Your org has enabled the Graphite merge queue for merging into canary

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link
Member Author

EYHN commented Nov 25, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Comment on lines +107 to +124
waitForConnected(signal?: AbortSignal) {
return new Promise<void>((resolve, reject) => {
if (this.status === 'connected') {
resolve();
return;
}

this.onStatusChanged(status => {
if (status === 'connected') {
resolve();
}
});

signal?.addEventListener('abort', reason => {
reject(reason);
});
});
}
Copy link

Choose a reason for hiding this comment

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

The AbortSignal event listener should be cleaned up if the connection is already connected. Currently, if this.status === 'connected', the promise resolves but the abort listener is still registered. Consider returning a cleanup function from addEventListener and calling it in the early return case:

const cleanup = signal?.addEventListener('abort', reason => {
  reject(reason);
});

if (this.status === 'connected') {
  cleanup?.();
  resolve();
  return;
}

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Member

Choose a reason for hiding this comment

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

cleanup

@EYHN EYHN changed the title feat(nbstore): new sync engine feat(nbstore): new doc sync engine Nov 25, 2024
Copy link

nx-cloud bot commented Nov 25, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 43f079e. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 64.09496% with 121 lines in your changes missing coverage. Please review.

Project coverage is 70.31%. Comparing base (b5fed7b) to head (43f079e).
Report is 12 commits behind head on canary.

Files with missing lines Patch % Lines
packages/common/nbstore/src/sync/doc/peer.ts 61.68% 68 Missing and 14 partials ⚠️
...ackages/common/nbstore/src/utils/priority-queue.ts 68.75% 7 Missing and 3 partials ⚠️
packages/common/nbstore/src/utils/clock.ts 56.25% 5 Missing and 2 partials ⚠️
...ckages/common/nbstore/src/connection/connection.ts 33.33% 5 Missing and 1 partial ⚠️
packages/common/nbstore/src/impls/idb/sync.ts 53.84% 4 Missing and 2 partials ⚠️
...s/common/nbstore/src/utils/async-priority-queue.ts 75.00% 3 Missing and 2 partials ⚠️
...kages/common/nbstore/src/utils/throw-if-aborted.ts 50.00% 1 Missing and 1 partial ⚠️
packages/common/nbstore/src/impls/idb/doc.ts 88.88% 0 Missing and 1 partial ⚠️
packages/common/nbstore/src/storage/history.ts 0.00% 1 Missing ⚠️
packages/common/nbstore/src/sync/index.ts 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           canary    #8918      +/-   ##
==========================================
- Coverage   70.84%   70.31%   -0.53%     
==========================================
  Files         550      566      +16     
  Lines       33992    34365     +373     
  Branches     3089     3105      +16     
==========================================
+ Hits        24080    24164      +84     
- Misses       9559     9800     +241     
- Partials      353      401      +48     
Flag Coverage Δ
server-test 77.07% <ø> (-0.75%) ⬇️
unittest 47.69% <64.09%> (+1.60%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Related to test cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants