Centralize hardcoded timing and timeout constants #31
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Over 15 timing and timeout constants are scattered as magic numbers across 6 different files. These values control critical behavior (network timeouts, SSE reconnection strategy, UI responsiveness) but are invisible to operators and impossible to tune without modifying source code.
This issue focuses specifically on centralizing these constants. Once #29 (YAML config) lands, these can be further externalized, but even before that they should be collected into a single, well-documented location.
Inventory of Hardcoded Timing Constants
Network Timeouts
timeout=10/readyendpoint HTTP timeouttimeout=90_HTTP_TIMEOUT=10_DNS_TIMEOUT=5timeout=5timeout=5SSE Reconnection Strategy
_MAX_RETRIES = 10_BASE_DELAY = 1_MAX_DELAY = 60UI Timing
30000(30s)60000(60s)60000(60s)300(300ms)30000(30s)500(500ms)500(500ms)2500(2.5s)500(500ms)Problems
2500,30000,60000appear without explanation of why those specific values were chosen.Proposed Solution
Phase 1: Centralize into a constants module
Create
freecad/silo_constants.py(or a_defaultssection in the future config module):Phase 2: Replace all magic numbers
Update all 6 files to import from the constants module instead of using inline literals.
Phase 3: Wire into YAML config (depends on #29)
Once the YAML config system exists, these constants become the defaults that can be overridden via config.
Acceptance Criteria
silo_commands.py,schema_form.py,open_search.py,silo_start.py, orInitGui.py