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
Made the choice set manager thread safe #1603
Made the choice set manager thread safe #1603
Conversation
Fixed a bug with blocks updating the list of pending and uploaded choices after mgr closed.
Co-Authored-By: Joel Fischer <joeljfischer@gmail.com>
Co-Authored-By: Joel Fischer <joeljfischer@gmail.com>
SDLLogD(@"Finished deleting choices"); | ||
[weakself.preloadedMutableChoices minusSet:cellsToBeDeleted]; | ||
// Check if the manager has shutdown because the list of uploaded choices should not be updated | ||
if ([strongSelf.currentState isEqualToString:SDLChoiceManagerStateShutdown]) { |
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.
Instead of checking the state here and in other blocks, we could just "reset" all the properties in the start
method.
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'm not sure what you mean by that. Why would resetting properties in start
help? They're already reset in didEnterStateShutdown
.
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.
The problem is that the didEnterStateShutdown
is called and all the properties reset before the completion block is called for the choice set upload. Then in the completion block, some of the properties are set.
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.
Ah I gotcha. I think this is a better way to do it. Better not to set the properties at all than to have to reset them later. If a dev checks them while it's shut down it'll show the wrong data.
Fixes #1584
This PR is ready for review.
Risk
This PR makes no API changes.
Testing Plan
Unit Tests
Added test cases to the SDLChoiceSetManagerSpec to verify that the list of pending and uploaded choice items is not updated after the choice set manager is shutdown. This can happen if the transport is destroyed while choice items are being preloaded, deleted or presented.
Core Tests
Core version / branch / commit hash / module tested against: SYNC 3.0
HMI name / version / branch / commit hash / module tested against: SYNC 3.0
Summary
Made the choice set manager thread safe.
Changelog
Bug Fixes
NSMutableSet
s at the same time.choiceId
orcancelId
.INVALID_ID
. This was due to adding choice set items to the list of pending and presenting choice items after the transport was destroyed. Since the library thought those choice items were on the module, they were not uploaded, thus creating an error when trying to present the choice set items.Tasks Remaining:
CLA