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
open-webui
Commits
d7d8896e
Commit
d7d8896e
authored
Jun 07, 2024
by
Timothy J. Baek
Browse files
fix: active users
parent
f78e6a5f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
backend/apps/socket/main.py
backend/apps/socket/main.py
+10
-6
No files found.
backend/apps/socket/main.py
View file @
d7d8896e
...
...
@@ -134,13 +134,17 @@ async def remove_after_timeout(sid, model_id):
@
sio
.
event
async
def
disconnect
(
sid
):
if
sid
in
USER_POOL
:
disconnected_user
=
SESSION_POOL
.
pop
(
sid
)
USER_POOL
[
disconnected_user
].
remove
(
sid
)
if
len
(
USER_POOL
[
disconnected_user
])
==
0
:
del
USER_POOL
[
disconnected_user
]
if
sid
in
SESSION_POOL
:
user_id
=
SESSION_POOL
[
sid
]
del
SESSION_POOL
[
sid
]
print
(
f
"user
{
disconnected_user
}
disconnected with session ID
{
sid
}
"
)
USER_POOL
[
user_id
].
remove
(
sid
)
if
len
(
USER_POOL
[
user_id
])
==
0
:
del
USER_POOL
[
user_id
]
print
(
f
"user
{
user_id
}
disconnected with session ID
{
sid
}
"
)
print
(
USER_POOL
)
await
sio
.
emit
(
"user-count"
,
{
"count"
:
len
(
USER_POOL
)})
else
:
...
...
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