Skip to content
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

Ensure that sources are properly refreshed on sync #916

Merged
merged 1 commit into from
Mar 13, 2020

Conversation

rmol
Copy link
Contributor

@rmol rmol commented Mar 11, 2020

Description

Fixes #888.

In widgets.SourceList.update, make sure that existing SourceWidgets are updated. This requires refreshing each source's state in the controller session. On sync, sources were being properly updated in the database via storage.update_sources, but without this refresh, a source being unstarred on the server, for example, wouldn't be reflected in the UI until some other operation caused the source to be refreshed in the controller's session.

Commit after updating a source's is_starred field in widgets.StarToggleButton.on_update, preventing a sqlite3.OperationalError saying "database is locked".

In sync.ApiSync.on_sync_failure, keep syncing no matter the error, and have the log message say less about the cause.

Log more details about API job failure in api_jobs.base.ApiJob._do_call_api.

Test Plan

Follow #888 STR. You should not get a "database locked" error and when the source is unstarred in the journalist interface, it should also be unstarred in the client after the very next sync.

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:

  • I have tested these changes in the appropriate Qubes environment
  • I do not have an appropriate Qubes OS workstation set up (the reviewer will need to test these changes)
  • These changes should not need testing in Qubes

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:

  • I have submitted a separate PR to the packaging repo
  • No update to the packaging logic (e.g., AppArmor profile) is required for these changes
  • I don't know and would appreciate guidance

sssoleileraaa
sssoleileraaa previously approved these changes Mar 11, 2020
securedrop_client/gui/widgets.py Outdated Show resolved Hide resolved
securedrop_client/logic.py Outdated Show resolved Hide resolved
@sssoleileraaa
Copy link
Contributor

@rmol hey this just needs a rebase after #919 is fixed on master (i'm looking into it now but it is eod for me so maybe you'll get to it before me in the morning)

@rmol
Copy link
Contributor Author

rmol commented Mar 12, 2020

Rebased, reworked, ready for rereview.

@rmol rmol force-pushed the 888-unstar-db-lock branch from 49b533a to 9c3c171 Compare March 12, 2020 20:48
@sssoleileraaa
Copy link
Contributor

I still see this blocked because of #919 happening on master. Perhaps someone else can confirm?

@sssoleileraaa sssoleileraaa self-requested a review March 13, 2020 17:26
@rmol rmol force-pushed the 888-unstar-db-lock branch from 9c3c171 to f53f9a9 Compare March 13, 2020 20:20
@rmol rmol force-pushed the 888-unstar-db-lock branch from f53f9a9 to 8dcbaaf Compare March 13, 2020 20:42
In widgets.SourceList.update, make sure that existing SourceWidgets
are updated. This requires refreshing each source's state in the
controller session. On sync, sources were being properly updated in
the database via storage.update_sources, but without this refresh, a
source being unstarred on the server, for example, wouldn't be
reflected in the UI until some other operation caused the source to be
refreshed in the controller's session.

Commit after updating a source's is_starred field in
widgets.StarToggleButton.on_update, preventing a
sqlite3.OperationalError saying "database is locked".

In sync.ApiSync.on_sync_failure, keep syncing no matter the error, and
have the log message say less about the cause.

Log more details about API job failure in
api_jobs.base.ApiJob._do_call_api.
Copy link
Contributor

@sssoleileraaa sssoleileraaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sssoleileraaa sssoleileraaa merged commit 7066e9b into master Mar 13, 2020
@sssoleileraaa sssoleileraaa deleted the 888-unstar-db-lock branch March 13, 2020 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[0.2.1-deb] Syncing unstar action in JI results in database lock error
2 participants