-
Notifications
You must be signed in to change notification settings - Fork 879
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 sync resend #2959
Fix sync resend #2959
Conversation
91dc531
to
aee97c3
Compare
@@ -90,7 +90,7 @@ BraveSyncServiceImpl::BraveSyncServiceImpl(Profile* profile) : | |||
sync_client_.get(), | |||
sync_prefs_.get())), | |||
timer_(std::make_unique<base::RepeatingTimer>()), | |||
unsynced_send_interval_(base::TimeDelta::FromMinutes(10)) { | |||
unsynced_send_interval_(base::TimeDelta::FromMinutes(60)) { |
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.
Why do we need to change it from 10 to 60 mins? The bug is in where we mark sync_timestamp
.
If we bump it to 60 mins, consider there is an update for a certain bookmark, let's say url changes, it will take up to 60 mins for it to send the record.
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.
unsynced_send_interval_
works here https://github.com/brave/brave-core/blob/master/components/brave_sync/client/bookmark_change_processor.cc#L943
std::string last_send_time;
node->GetMetaInfo("last_send_time", &last_send_time);
if (!last_send_time.empty() &&
// don't send more often than unsynced_send_interval_
(base::Time::Now() -
base::Time::FromJsTime(std::stod(last_send_time))) <
unsynced_send_interval)
continue;
and affects only on re-sends.
For the regular bookmark modification we will clear "last_send_time"
at https://github.com/brave/brave-core/blob/master/components/brave_sync/client/bookmark_change_processor.cc#L373
void BookmarkChangeProcessor::BookmarkNodeChanged(BookmarkModel* model,
const BookmarkNode* node) {
// clearing the sync_timestamp will put the record back in the `Unsynced` list
model->DeleteNodeMetaInfo(node, "sync_timestamp");
// also clear the last send time because this is a new change
model->DeleteNodeMetaInfo(node, "last_send_time");
model->SetNodeMetaInfo(node,
"last_updated_time",
std::to_string(base::Time::Now().ToJsTime()));
}
and it will not check for unsynced_send_interval
at https://github.com/brave/brave-core/blob/master/components/brave_sync/client/bookmark_change_processor.cc#L939 .
So the regular send will happened once in 1 min.
And the resend will happened once in 60 min.
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
STR are in brave/brave-browser#5300
Reviewer Checklist:
After-merge Checklist:
changes has landed on.