-
Notifications
You must be signed in to change notification settings - Fork 37
ROBJSTORE-98 Implement precise and unbatched notification of sync completion events #1118
Conversation
@tgoyne let me know if you have time to review this. |
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 logic looks correct to me and just a few trivial nits.
src/sync/sync_session.cpp
Outdated
SyncSession::CompletionCallbacks callbacks_to_register; | ||
std::swap(session.m_completion_callbacks, callbacks_to_register); | ||
|
||
for (auto& [ id, callback_tuple ] : callbacks_to_register) { |
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.
Spacing on structured binding is inconsistent here; some have spaces in [] and some don't. I think no spaces is the normal thing?
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.
Sure
src/sync/sync_session.cpp
Outdated
auto download_handlers = std::move(m_download_completion_callbacks); | ||
auto upload_handlers = std::move(m_upload_completion_callbacks); | ||
|
||
auto completion_callbacks = std::move(m_completion_callbacks); |
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.
In the other spots we do this you changed it to swapping with a local which is probably better, so this one should as well.
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.
Will do. I also added a FIXME comment since I realized advance_state is not exception safe so we should make sure that we always move the callbacks back in place by using a guard type, but I don't think we need to fix that in this PR.
e833e54
to
02bc1c0
Compare
Opening this in lieu of #1054.