4848 "REQUEST_IMAGES" : 2 ,
4949}
5050
51-
51+ # WebSocket connection health check timeout (milliseconds)
52+ # Maximum time to wait for pong response after sending ping
53+ # Used in: server.heartBeat() to detect connection loss
5254PING_TIMEOUT_DURATION = 10000
55+
56+ # WebSocket ping interval (milliseconds)
57+ # How often to send ping messages to keep connection alive
58+ # Used in: server.heartBeat() for periodic health checks
5359PING_INTERVAL = 5000
5460
61+ # Image generation timeout (milliseconds)
62+ # Maximum time to wait for image generation completion (imageInference, photoMaker)
63+ # Used in: photoMaker(), getSimililarImage() for waiting image generation results
5564IMAGE_INFERENCE_TIMEOUT = int (os .environ .get (
5665 "RUNWARE_IMAGE_INFERENCE_TIMEOUT" ,
5766 300000
5867))
5968
69+ # Image operation timeout (milliseconds)
70+ # Maximum time to wait for image operations (caption, background removal, upscale)
71+ # Used in: imageCaption(), imageBackgroundRemoval(), imageUpscale()
6072IMAGE_OPERATION_TIMEOUT = int (os .environ .get (
6173 "RUNWARE_IMAGE_OPERATION_TIMEOUT" ,
6274 120000
6375))
6476
77+ # Image upload timeout (milliseconds)
78+ # Maximum time to wait for image upload to complete
79+ # Used in: uploadImage() for uploading local images or base64 data
6580IMAGE_UPLOAD_TIMEOUT = int (os .environ .get (
6681 "RUNWARE_IMAGE_UPLOAD_TIMEOUT" ,
6782 60000
6883))
6984
70- VIDEO_INFERENCE_TIMEOUT = int (os .environ .get (
71- "RUNWARE_VIDEO_INFERENCE_TIMEOUT" ,
72- 600000
73- ))
74-
85+ # Video initial response timeout (milliseconds)
86+ # Maximum time to wait for initial video generation response or polling response
87+ # Used in: _handleInitialVideoResponse(), _sendPollRequest()
7588VIDEO_INITIAL_TIMEOUT = int (os .environ .get (
7689 "RUNWARE_VIDEO_INITIAL_TIMEOUT" ,
7790 30000
7891))
7992
93+ # Video polling delay (milliseconds)
94+ # Delay between consecutive polling requests for video generation status
95+ # Used in: _pollVideoResults() for checking video generation progress
8096VIDEO_POLLING_DELAY = int (os .environ .get (
8197 "RUNWARE_VIDEO_POLLING_DELAY" ,
82- 3
83- ))
84-
85- VIDEO_OPERATION_TIMEOUT = int (os .environ .get (
86- "RUNWARE_VIDEO_OPERATION_TIMEOUT" ,
87- 120000
98+ 3000
8899))
89100
101+ # Audio generation timeout (milliseconds)
102+ # Maximum time to wait for audio generation completion
103+ # Used in: _waitForAudioCompletion() for single audio generation
90104AUDIO_INFERENCE_TIMEOUT = int (os .environ .get (
91105 "RUNWARE_AUDIO_INFERENCE_TIMEOUT" ,
92106 300000
93107))
94108
95- AUDIO_OPERATION_TIMEOUT = int (os .environ .get (
96- "RUNWARE_AUDIO_OPERATION_TIMEOUT" ,
97- 120000
109+ # Audio polling delay (milliseconds)
110+ # Delay between consecutive polling requests for audio generation status
111+ # Used in: _pollForAudioResults() for checking audio generation progress
112+ AUDIO_POLLING_DELAY = int (os .environ .get (
113+ "RUNWARE_AUDIO_POLLING_DELAY" ,
114+ 1000
98115))
99116
117+ # Prompt enhancement timeout (milliseconds)
118+ # Maximum time to wait for prompt enhancement completion
119+ # Used in: promptEnhance() for enhancing text prompts
100120PROMPT_ENHANCE_TIMEOUT = int (os .environ .get (
101121 "RUNWARE_PROMPT_ENHANCE_TIMEOUT" ,
102122 60000
103123))
104124
125+ # Webhook acknowledgment timeout (milliseconds)
126+ # Maximum time to wait for webhook task acknowledgment
127+ # Used in: videoCaption(), videoBackgroundRemoval(), videoUpscale() when webhook is provided
105128WEBHOOK_TIMEOUT = int (os .environ .get (
106129 "RUNWARE_WEBHOOK_TIMEOUT" ,
107130 30000
108131))
109132
110- POLLING_INTERVAL = int (os .environ .get ("RUNWARE_POLLING_INTERVAL" , 1000 ))
111-
133+ # Default timeout duration (milliseconds)
134+ # Maximum time to wait for general operations (model upload, model search, media upload)
135+ # Used in: RunwareBase.__init__(), uploadMedia(), modelUpload(), modelSearch()
112136TIMEOUT_DURATION = int (os .environ .get (
113137 "RUNWARE_TIMEOUT_DURATION" ,
114138 480000
115139))
140+ # Maximum polling attempts for video generation
141+ # Number of polling iterations before timing out video generation
142+ # Used in: _pollVideoResults() for video generation status checks
143+ MAX_POLLS_VIDEO_GENERATION = int (os .environ .get ("RUNWARE_MAX_POLLS_VIDEO_GENERATION" , 480 ))
116144
145+ # Maximum polling attempts for audio generation
146+ # Number of polling iterations before timing out audio generation
147+ # Used in: _pollAudioResults() for audio generation status checks
148+ MAX_POLLS_AUDIO_GENERATION = int (os .environ .get ("RUNWARE_MAX_POLLS_AUDIO_GENERATION" , 240 ))
117149
118150class LISTEN_TO_IMAGES_KEY :
119151 REQUEST_IMAGES = "REQUEST_IMAGES"
@@ -874,4 +906,4 @@ async def process_image(
874906 return image .imageUUID
875907 if isLocalFile (image ) and not image .startswith ("http" ):
876908 return await fileToBase64 (image )
877- return image
909+ return image
0 commit comments