-
Notifications
You must be signed in to change notification settings - Fork 42
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
Minimize sync db work #1036
Minimize sync db work #1036
Conversation
(Per PR body, labeled |
Avoid dirtying synced objects on update unless they've actually changed, and reduce the number of commits.
7cb9a22
to
d8cae09
Compare
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.
this lgtm, the name lazy_setattr made me think you were deferring setting the attribute but it's clear by the code and comment that it only sets attributes when the attribute on the server is different than what we store locally.
@@ -133,8 +133,21 @@ def update_local_storage(session: Session, | |||
update_replies(remote_replies, get_local_replies(session), session, data_dir) | |||
|
|||
|
|||
def update_sources(remote_sources: List[SDKSource], local_sources: | |||
List[Source], session: Session, data_dir: str) -> None: | |||
def lazy_setattr(o: Any, a: str, v: Any) -> None: |
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.
minimal names!
List[Source], session: Session, data_dir: str) -> None: | ||
def lazy_setattr(o: Any, a: str, v: Any) -> None: | ||
""" | ||
Only assign v to o.a if they differ. |
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.
👍
Description
Avoid dirtying synced objects on update unless they've actually changed, and reduce the number of commits.
This is based on and should be reviewed after #1035.
Test Plan
Run the SD core dev server. Ensure that syncing completes, that the source list and conversation view populate correctly, and that you can reply to sources.
Checklist
If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable:
If these changes add or remove files other than client code, packaging logic (e.g., the AppArmor profile) may need to be updated. Please check as applicable: