-
Notifications
You must be signed in to change notification settings - Fork 32
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: git#865 - fixes notifying the switch atSign event multiple times #867
Conversation
Found the root cause of failing end2end_tests. Will fix the issue and push the changes. |
759895b
to
a4b8c0b
Compare
a4b8c0b
to
c72d1f3
Compare
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.
As discussed just now, we don't need the 'isActive' flag. The concurrent modification error can be eliminated by having _notifyListeners
make a copy of the _changeListeners and iterate through the copy of the list rather than through the list itself.
As a side note - force-pushing your branch is masking useful information about the evolution of the code - without seeing the interim commits, it was completely unclear to me why the isActive flag was added until we had our discussion. Is there a reason you prefer force-push?
@gkc: Sure, will update the code as per our discussion. I generally do a force push to keep the commit history clean. However, I do it only when there are no review comments/discussions on the PR. If there are review comments/discussions on the PR I avoid doing a force push. |
I understand. However sometimes (as in this case), squashing the commits makes it impossible to understand how you got to a particular design / implementation decision, without having a conversation. |
Ok Gary, Will avoid force pushing to the branch. |
packages/at_client/lib/src/service/notification_service_impl.dart
Outdated
Show resolved
Hide resolved
…eing created when the atClients are the same debug: Added a logger to AtClientManager. Log INFO when switching atSigns refactor: Removed instance variable _previousAtClient from AtClientManager. Instead, determine previousAtClient within the setCurrentAtSign method fix: Added duplicate check to AtClientManager.listenToAtSignChange fix: Changed _currentAtClient from `late` to being nullable to prevent uninitialized check in setCurrentAtSign fix: AtClientManager now calls _notifyListeners before creating the new NotificationServiceImpl and SyncServiceImpl refactor: Removed static maps of instances in NotificationServiceImpl and SyncServiceImpl thus allowing some code simplification refactor: Simplified NotificationServiceImpl.listenToAtSignChange refactor: Simplified SyncServiceImpl.listenToAtSignChange, and added code to close the RemoteSecondary's AtLookUp's connection if there is one
- What I did
AtClientManager._changeListeners
list.- How I did it
removeChangeListener
method in AtClientManager, that removes the given instance of AtSignChangeListener fromAtClientManager._changeListeners
listAtClientManager._notifyListeners
added a line that clones the _changeListeners list and iterate on the cloned list to avoid the concurrent modification exception.late
to being nullable to prevent uninitialized check in setCurrentAtSign- How to verify it
AtClientManager._changeListeners
should not have obsolete listeners.- Description for the changelog
AtClientManager._changeListeners
list.