@@ -46,18 +46,38 @@ def setup_paddle_billing() -> None:
4646 """Initialize Paddle billing client and provision plans."""
4747 if settings_service .settings .paddle_api_key and settings_service .settings .paddle_client_key :
4848 logger .info ("Paddle billing configured; initializing client and provisioning plans." )
49- try :
50- from langflow .services .paddle .provisioning import provision_paddle_plans
51-
52- initialize_paddle_client (settings_service .settings .paddle_api_key )
53- provision_paddle_plans ()
54- logger .info ("Paddle billing setup completed successfully." )
55- except Exception as exc :
56- logger .error (f"Failed to initialize Paddle billing: { exc } " )
57- raise
49+ for attempt in range (1 , 4 ):
50+ try :
51+ from langflow .services .paddle .provisioning import provision_paddle_plans
52+
53+ initialize_paddle_client (settings_service .settings .paddle_api_key )
54+ break
55+ except Exception as exc :#noqa: BLE001
56+ logger .error (
57+ "Paddle client initialization failed (attempt %s/3): %s" ,
58+ attempt ,
59+ exc ,
60+ )
61+ else :
62+ logger .error ("Paddle client initialization failed after 3 attempts; skipping provisioning." )
63+ return
64+
65+ for attempt in range (1 , 4 ):
66+ try :
67+ provision_paddle_plans ()
68+ logger .info ("Paddle billing setup completed successfully." )
69+ return #noqa:TRY300
70+ except Exception as exc :#noqa: BLE001
71+ logger .error (
72+ "Paddle product/prices creation failed (attempt %s/3): %s" ,
73+ attempt ,
74+ exc ,
75+ )
76+
77+ logger .error ("Paddle product/prices creation failed after 3 attempts; continuing startup." )
5878 else :
5979 msg = (
6080 "Paddle billing env vars missing; set PADDLE_API_KEY and PADDLE_CLIENT_KEY "
6181 "to enable billing."
6282 )
63- raise RuntimeError (msg )
83+ logger . warning (msg )
0 commit comments