Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #25
We were blocking the main thread on accessing sub-Catalogs. We already use
create_worker
(a nice wrapper aroundQRunnable
that we vendored from napari) to access the items in a Catalog. This PR applies that approach to the initial sub-Catalog access as well, which is when MongoDB client--server connection happens and has the potential to hang for 30 seconds.I tested this against this configuration file, which points to a nonexistent MongoDB deployment.
When I select this item in the GUI, the combobox is immediately disabled but the GUI remains responsive. After 30 seconds (pymongo's default server selection timeout) the traceback is logged, the combox is re-enabled and reset to a blank value.
It would be nice if we could back out before waiting for the timeout---that is, to give the option to cancel the operation before it succeeds for times out. Cancellation is generally difficult to get right, so I would like to punt that to a future PR.
As is, this at least does not lock up the application and does leave it in a usable state after the failure.
Needs a unit test