ynput / ayon-launcher

AYON desktop application launcher
Apache License 2.0
32 stars 14 forks source link

Handling of expired session #62

Open antirotor opened 1 year ago

antirotor commented 1 year ago

Problem

When you put your computer to sleep for some time when your AYON is still running and you wake it after some time, login session problably expires between launcher and server, resulting in:

Traceback (most recent call last):
  File "C:\Users\annat\AppData\Local\Ynput\AYON\addons\openpype_3.17.4-nightly.1\openpype\tools\ayon_launcher\ui\actions_widget.py", line 451, in _on_clicked
    self._controller.trigger_action(
  File "C:\Users\annat\AppData\Local\Ynput\AYON\addons\openpype_3.17.4-nightly.1\openpype\tools\ayon_launcher\control.py", line 131, in trigger_action
    self._actions_model.trigger_action(
  File "C:\Users\annat\AppData\Local\Ynput\AYON\addons\openpype_3.17.4-nightly.1\openpype\tools\ayon_launcher\models\actions.py", line 342, in trigger_action
    session = self._prepare_session(project_name, folder_id, task_id)
  File "C:\Users\annat\AppData\Local\Ynput\AYON\addons\openpype_3.17.4-nightly.1\openpype\tools\ayon_launcher\models\actions.py", line 407, in _prepare_session
    folder = self._controller.get_folder_entity(
  File "C:\Users\annat\AppData\Local\Ynput\AYON\addons\openpype_3.17.4-nightly.1\openpype\tools\ayon_launcher\control.py", line 82, in get_folder_entity
    return self._hierarchy_model.get_folder_entity(
  File "C:\Users\annat\AppData\Local\Ynput\AYON\addons\openpype_3.17.4-nightly.1\openpype\tools\ayon_utils\models\hierarchy.py", line 369, in get_folder_entity
    output = self.get_folder_entities(project_name, {folder_id})
  File "C:\Users\annat\AppData\Local\Ynput\AYON\addons\openpype_3.17.4-nightly.1\openpype\tools\ayon_utils\models\hierarchy.py", line 362, in get_folder_entities
    self._query_folder_entities(project_name, folder_ids_to_query)
  File "C:\Users\annat\AppData\Local\Ynput\AYON\addons\openpype_3.17.4-nightly.1\openpype\tools\ayon_utils\models\hierarchy.py", line 470, in _query_folder_entities
    for folder in folders:
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\ayon-launcher\.venv\lib\site-packages\ayon_api\server_api.py", line 3670, in get_folders
    for parsed_data in query.continuous_query(self):
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\ayon-launcher\.venv\lib\site-packages\ayon_api\graphql.py", line 370, in continuous_query
    response = con.query_graphql(query_str, variables)
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\ayon-launcher\.venv\lib\site-packages\ayon_api\server_api.py", line 1696, in query_graphql
    response.raise_for_status()
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\ayon-launcher\.venv\lib\site-packages\ayon_api\server_api.py", line 184, in raise_for_status
    raise HTTPRequestError(message, exc.response)
ayon_api.exceptions.HTTPRequestError: 401 Client Error: Unauthorized for url: http://localhost:5000/graphql

but this is not handled in UI at all - so it seems that almost nothing works (like launching DCCs in launcher, etc.)

We should handle this more gracefully and pop-up login dialog again.