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
6de6246d
Commit
6de6246d
authored
Feb 25, 2023
by
comfyanonymous
Browse files
Fix some potential issues related to threads.
parent
8074a58a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
14 deletions
+26
-14
main.py
main.py
+12
-0
server.py
server.py
+14
-14
No files found.
main.py
View file @
6de6246d
...
...
@@ -371,6 +371,18 @@ class PromptQueue:
return
True
return
False
def
get_history
(
self
):
with
self
.
mutex
:
return
copy
.
deepcopy
(
self
.
history
)
def
wipe_history
(
self
):
with
self
.
mutex
:
self
.
history
=
{}
def
delete_history_item
(
self
,
id_to_delete
):
with
self
.
mutex
:
self
.
history
.
pop
(
id_to_delete
,
None
)
async
def
run
(
server
,
address
=
''
,
port
=
8188
):
await
asyncio
.
gather
(
server
.
start
(
address
,
port
),
server
.
publish_loop
())
...
...
server.py
View file @
6de6246d
...
...
@@ -82,7 +82,7 @@ class PromptServer():
@
routes
.
get
(
"/history"
)
async
def
get_history
(
request
):
return
web
.
json_response
(
self
.
prompt_queue
.
history
)
return
web
.
json_response
(
self
.
prompt_queue
.
get_
history
()
)
@
routes
.
get
(
"/queue"
)
async
def
get_queue
(
request
):
...
...
@@ -146,11 +146,11 @@ class PromptServer():
json_data
=
await
request
.
json
()
if
"clear"
in
json_data
:
if
json_data
[
"clear"
]:
self
.
prompt_queue
.
history
=
{}
self
.
prompt_queue
.
wipe_
history
()
if
"delete"
in
json_data
:
to_delete
=
json_data
[
'delete'
]
for
id_to_delete
in
to_delete
:
self
.
prompt_queue
.
history
.
pop
(
id_to_delete
,
None
)
self
.
prompt_queue
.
delete_
history
_item
(
id_to_delete
)
return
web
.
Response
(
status
=
200
)
...
...
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