Fix auto_filing: check env var before ERPNext to avoid hanging on dev
When AUTO_FILING_ENABLED is explicitly set as an env var, skip the ERPNext API call entirely. The ERPNext client hangs indefinitely when the host is unreachable (dev workers can't reach prod ERPNext), blocking all compliance handlers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9be495dbb9
commit
0bdaa4c373
1 changed files with 4 additions and 0 deletions
|
|
@ -74,6 +74,10 @@ def _env_truthy(value: str | None) -> bool:
|
|||
|
||||
def _settings_from_erpnext() -> tuple[bool, str]:
|
||||
"""Read ``Compliance Settings`` from ERPNext — returns (enabled, admin_email)."""
|
||||
# Fast path: if AUTO_FILING_ENABLED env var is explicitly set, skip ERPNext
|
||||
env_val = os.environ.get("AUTO_FILING_ENABLED")
|
||||
if env_val is not None:
|
||||
return _env_truthy(env_val), (os.environ.get("ADMIN_EMAIL") or DEFAULT_ADMIN_EMAIL)
|
||||
try:
|
||||
from scripts.workers.erpnext_client import ERPNextClient
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue