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 issue that sync callback is started twice #2642

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bitfriend
Copy link
Contributor

I found that sync callback is started twice.
This affects the initial loading time and probably may occur app crash due to too frequent mutex locks.

@bitfriend bitfriend added the bug Something isn't working label Feb 21, 2025
@bitfriend
Copy link
Contributor Author

The following screenshot shows that sync callback is started twice.
image

Copy link

codecov bot commented Feb 21, 2025

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.

Project coverage is 33.31%. Comparing base (e0c1c79) to head (f1621cf).

Files with missing lines Patch % Lines
.../lib/common/providers/notifiers/sync_notifier.dart 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2642      +/-   ##
==========================================
- Coverage   33.35%   33.31%   -0.05%     
==========================================
  Files         744      744              
  Lines       48314    48320       +6     
==========================================
- Hits        16116    16096      -20     
- Misses      32198    32224      +26     
Flag Coverage Δ
integration-test 43.30% <ø> (-0.11%) ⬇️
unittest 24.11% <0.00%> (-0.01%) ⬇️

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.

@bitfriend
Copy link
Contributor Author

This screenshot shows that alwaysClientProvider callback is called twice.
image

@bitfriend
Copy link
Contributor Author

bitfriend commented Feb 21, 2025

alwaysClientProvider is based on AlwaysClientNotifier that is listening to clientProvider.
As a result, alwaysClientProvider is the wrapper of clientProvider.
So that callback seems to be called twice.

@bitfriend
Copy link
Contributor Author

When SyncNotifier listens to clientProvider instead of alwaysClientProvider, sync callback is started only once.
image

@bitfriend
Copy link
Contributor Author

I recall alwaysClientProvider was used here to avoid that guest client (not-logged-in) starts sync callback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

1 participant