You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the only way to access the settings is to read them from the user database with the DBHandler.get_settings method.
This creates a challenge in moving these constants to settings because these constants are used in many places, including places where the dbhandler instance is not available. For example in rotkehlchen/chain/ethereum/graph.py or rotkehlchen/icons.py and elsewhere.
We discussed two possible solutions:
Pass down the dbhandler instance to all places where these constants are used (and get them from get_settings method).
Cache the settings in a global object, import this object directly where you need it and read the settings you want from it.
Additional details for solution 1
The change can happen gradually, by having these values both in constants and in settings and read them from settings when you can while keep using the constants when its difficult to get access to the dbhandler.
Additional details for solution 2
We can use a singleton to cache the settings. It is initialized at user login and deleted at user logout. Here is an approach using a SettingsManager singleton class https://gist.github.com/dimyG/27322bb312ed3659370b58f9d8338261. Then you can sync_with_user_db in dbhandler get_settings method, update the cached settings in dbhandler set_settings and set_setting methods. This singleton approach though is an antipattern. We only use them for things that are really global over the entire app such as the globalDB and global prices, while the settings is specific to the user and not to the app. Many users can have account to the same app installation.
Abstract
At the moment all connection related timeout and retries variables are hard-coded constants in the code:
rotki/rotkehlchen/constants/timing.py
Lines 16 to 18 in 9e64001
There is no possibility to customize them depending on the user's situation and connection capabilities.
Motivation
If a user is in a slow connection place we should allow them to configure these variables.
Specification
Make them configurable settings
The text was updated successfully, but these errors were encountered: