flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.32k stars 438 forks source link

Timeout Error in Client Storage API Methods (contains_key, set, get, clear) #2948

Open Hirvin opened 7 months ago

Hirvin commented 7 months ago

Description

The Client Storage API is encountering a timeout error when utilizing methods such as contains_key, set, get, and clear. This timeout issue is hindering the smooth operation of the API and needs to be addressed to ensure the reliability and functionality of the system.

This behavior is observed also in async version

Code example to reproduce the issue:

if self._page.client_storage.contains_key(CLIENT_STORAGE_KEYS.CURRENT_DAY.value):
                self._page.client_storage.set(
                    CLIENT_STORAGE_KEYS.CURRENT_DAY.value, new_date.day
                )

Describe the results you received:

Traceback (most recent call last): File "/workspaces/Consul-Manager/FleetApp/CommonRefContext/init.py", line 156, in set_current_date if self._page.client_storage.contains_key(CLIENT_STORAGE_KEYS.CURRENT_DAY.value): File "/workspaces/Consul-Manager/pythonEnv/flet21/lib/python3.10/site-packages/flet_core/client_storage.py", line 46, in contains_key self.__page._invoke_method( File "/workspaces/Consul-Manager/pythonEnv/flet21/lib/python3.10/site-packages/flet_core/page.py", line 863, in _invoke_method raise TimeoutError( TimeoutError: Timeout waiting for invokeMethod clientStorage:containskey({'key': 'current_day'}) call

Describe the results you expected:

not errors

Additional information you deem important (e.g. issue happens only occasionally):

Flet version (pip show flet):

Name: flet
Version: 0.21.2
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page: 
Author: Appveyor Systems Inc.
Author-email: hello@flet.dev
License: Apache-2.0
Location: /workspaces/Consul-Manager/pythonEnv/flet21/lib/python3.10/site-packages
Requires: cookiecutter, fastapi, flet-runtime, packaging, qrcode, uvicorn, watchdog
Required-by: 

Operating system:

Additional environment details:

ndonkoHenri commented 7 months ago

See this: https://github.com/flet-dev/flet/issues/2879#issuecomment-1997834885