Commit 00734ede authored by Rushan Suleymanov's avatar Rushan Suleymanov Committed by Commit Bot

[Sync] Untrack sharing message on commit error.

Do not send sharing message to sync server after first failure.

Bug: 1034930
Change-Id: Ic88c12d646ef8028a3280f017d851ba1759575ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2017410
Commit-Queue: Rushan Suleymanov <rushans@google.com>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarvitaliii <vitaliii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735351}
parent 2b0dbe55
......@@ -123,9 +123,9 @@ std::string SharingMessageBridgeImpl::GetStorageKey(
void SharingMessageBridgeImpl::OnCommitAttemptErrors(
const syncer::FailedCommitResponseDataList& error_response_list) {
for (const syncer::FailedCommitResponseData& response : error_response_list) {
// TODO(rushans): untrack entity in change processor on error. We cannot
// untrack it by only client tag hash and there is no storage key in
// response data.
// We do not want to retry committing again, thus, the bridge has to untrack
// the failed item.
change_processor()->UntrackEntityForClientTagHash(response.client_tag_hash);
ProcessCommitResponse(
response.client_tag_hash,
response.datatype_specific_error.sharing_message_error());
......@@ -137,8 +137,7 @@ void SharingMessageBridgeImpl::ProcessCommitResponse(
const sync_pb::SharingMessageCommitError& commit_error_message) {
const auto iter = commit_callbacks_.find(client_tag_hash);
if (iter == commit_callbacks_.end()) {
// TODO(crbug.com/1034930): mark as NOTREACHABLE() when the entity will be
// untracked on commit errors.
NOTREACHED();
return;
}
std::move(iter->second).Run(commit_error_message);
......
......@@ -138,6 +138,9 @@ TEST_F(SharingMessageBridgeTest, ShouldInvokeCallbackOnFailure) {
->set_error_code(sync_pb::SharingMessageCommitError::PERMISSION_DENIED);
response_list.push_back(std::move(response));
}
EXPECT_CALL(*processor(),
UntrackEntityForClientTagHash(entity_data.client_tag_hash));
bridge()->OnCommitAttemptErrors(response_list);
EXPECT_TRUE(commit_error.has_error_code());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment