archesproject / arches-qgis

A QGIS plugin for integration and data management with an Arches project.
GNU Affero General Public License v3.0
0 stars 1 forks source link

Login can a long take time and cause QGIS to become unresponsive whilst loading #3

Closed SDScandrettKint closed 2 weeks ago

SDScandrettKint commented 6 months ago

Entering url and login can take some time, and the UI looks like it has crashed, especially if the user clicks on the dialog it'll show "Not responding".

Video demonstration:

https://github.com/archesproject/arches-qgis/assets/119508494/60711801-97c3-488c-92ca-74749aa6a366

NOTE: before I changed my local environment I used Arches-via-docker, and this was much faster to log in, and this issue did not occur. Now I have reverted back to using a standard Arches local deployment (non-containerised) and this issue has surfaced. This could be a red herring and unrelated though.

SDScandrettKint commented 2 weeks ago

From a related stackoverflow thread - https://gis.stackexchange.com/questions/416403/qgis-crashes-when-creating-many-features-through-plugin

To keep your GUI responsive you need to use background threads. You can use QgsTask for this or also QThread or other methods to do this. Note that communicating from a background thread with the GUI directly will cause an immediate crash! So never ever use print() in a background thread!

Should we be using task manager or queues to make API calls? Then include loading symbol to show the plugin is working in the background.