Add check for already processed resumptions to ResumptionDataProcessor #3525
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.
Fixes #3522
This PR is ready for review.
Risk
This PR makes no API changes.
Summary
This PR is intended to improve synchronization in
ResumptionDataProcessorImpl::Restore()
method. Root cause of this problem is a case when some requests from HMI may be processed earlier than callback will be set in ResumptionDataProcessor. So in this case execution ofProcessResumptionStatus
method for such application will be aborted due to absence of callback, and this behavior is valid and expected. But after this variableis_requests_list_empty
will be assigned to true, and there is a problem, because now Restore() method doesn't have any checks for actual result of already performed operation. That's why in all such cases, regardless of actual resumption status, callback will be called with parameters mobile_apis::Result::SUCCESS and "Data resumption successful".That's why corresponding check is added to
Restore
method, also some refactoring is performed to avoid duplication of code, redundant checkHasDataToRestore
is deleted (now in fact it will be always true), and potential source of memory leak inEraseAppResumptionData
method is fixed (before only last request was deleted fromrequest_app_ids_
map).In current environment this issue is hard to reproduce, but it may be a problem if this code is used in other environment or in other systems (for example, with proprietary hardware) without synchronization improvement.
CLA