summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-24 12:11:03 +0300
committerPaul Buetow <paul@buetow.org>2026-05-24 12:11:03 +0300
commit6beadd91c11fee7b23017fac07a932f7ed8b21da (patch)
tree2cc7c9a882d40d97c1dd12889941c3cf7d22deb5
parent7118f8d3582d6f016090ff096a30951d8bda6f33 (diff)
fix(photo-enhance.rb): add open_timeout and read_timeout to all ComfyUI HTTP calls
-rwxr-xr-xphoto-enhance.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/photo-enhance.rb b/photo-enhance.rb
index 0715e05..0b48ceb 100755
--- a/photo-enhance.rb
+++ b/photo-enhance.rb
@@ -177,7 +177,8 @@ class ComfyUIClient
end
def get(path)
- Net::HTTP.get_response(URI("http://#{@host}:#{@port}#{path}"))
+ uri = URI("http://#{@host}:#{@port}#{path}")
+ Net::HTTP.start(uri.host, uri.port, open_timeout: 10, read_timeout: 120) { |h| h.get(uri) }
end
def post_json(path, payload)
@@ -185,7 +186,7 @@ class ComfyUIClient
req = Net::HTTP::Post.new(uri)
req['Content-Type'] = 'application/json'
req.body = JSON.generate(payload)
- Net::HTTP.start(uri.host, uri.port) { |h| h.request(req) }
+ Net::HTTP.start(uri.host, uri.port, open_timeout: 10, read_timeout: 120) { |h| h.request(req) }
end
def post_raw(path, body, content_type)
@@ -193,7 +194,7 @@ class ComfyUIClient
req = Net::HTTP::Post.new(uri)
req['Content-Type'] = content_type
req.body = body
- Net::HTTP.start(uri.host, uri.port, read_timeout: 120) { |h| h.request(req) }
+ Net::HTTP.start(uri.host, uri.port, open_timeout: 10, read_timeout: 120) { |h| h.request(req) }
end
def mime_type(path)