Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
6253ec4a
"web/vscode:/vscode.git/clone" did not exist on "74893be1ce6b8350d1eafea823450e9a002380e8"
Commit
6253ec4a
authored
Jun 15, 2023
by
comfyanonymous
Browse files
Fix server crashing because of terminated websocket connection.
parent
bb1f45d6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
server.py
server.py
+9
-4
No files found.
server.py
View file @
6253ec4a
...
...
@@ -30,6 +30,11 @@ import comfy.model_management
class
BinaryEventTypes
:
PREVIEW_IMAGE
=
1
async
def
send_socket_catch_exception
(
function
,
message
):
try
:
await
function
(
message
)
except
(
aiohttp
.
ClientError
,
aiohttp
.
ClientPayloadError
,
ConnectionResetError
)
as
err
:
print
(
"send error:"
,
err
)
@
web
.
middleware
async
def
cache_control
(
request
:
web
.
Request
,
handler
):
...
...
@@ -487,18 +492,18 @@ class PromptServer():
if
sid
is
None
:
for
ws
in
self
.
sockets
.
values
():
await
ws
.
send_bytes
(
message
)
await
send_socket_catch_exception
(
ws
.
send_bytes
,
message
)
elif
sid
in
self
.
sockets
:
await
self
.
sockets
[
sid
].
send_bytes
(
message
)
await
send_socket_catch_exception
(
self
.
sockets
[
sid
].
send_bytes
,
message
)
async
def
send_json
(
self
,
event
,
data
,
sid
=
None
):
message
=
{
"type"
:
event
,
"data"
:
data
}
if
sid
is
None
:
for
ws
in
self
.
sockets
.
values
():
await
ws
.
send_json
(
message
)
await
send_socket_catch_exception
(
ws
.
send_json
,
message
)
elif
sid
in
self
.
sockets
:
await
self
.
sockets
[
sid
].
send_json
(
message
)
await
send_socket_catch_exception
(
self
.
sockets
[
sid
].
send_json
,
message
)
def
send_sync
(
self
,
event
,
data
,
sid
=
None
):
self
.
loop
.
call_soon_threadsafe
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment