FIX: Celery preferences task using Redis

Co-authored-by: JustIceO7 <oscarcao777@gmail.com>
This commit is contained in:
Chris-1010
2025-03-05 17:35:28 +00:00
parent 4be3aa9a96
commit 9e665318c0
2 changed files with 7 additions and 9 deletions

View File

@@ -36,7 +36,7 @@ const ChatPanel: React.FC<ChatPanelProps> = ({ streamId, onViewerCountChange })
if (socket && isConnected) { if (socket && isConnected) {
// Add username check // Add username check
socket.emit("join", { socket.emit("join", {
userId: userId ? userId : null, user_id: userId ? userId : null,
username: username ? username : "Guest", username: username ? username : "Guest",
stream_id: streamId, stream_id: streamId,
}); });
@@ -44,7 +44,7 @@ const ChatPanel: React.FC<ChatPanelProps> = ({ streamId, onViewerCountChange })
// Handle beforeunload event // Handle beforeunload event
const handleBeforeUnload = () => { const handleBeforeUnload = () => {
socket.emit("leave", { socket.emit("leave", {
userId: userId ? userId : null, user_id: userId ? userId : null,
username: username ? username : "Guest", username: username ? username : "Guest",
stream_id: streamId, stream_id: streamId,
}); });
@@ -205,7 +205,7 @@ const ChatPanel: React.FC<ChatPanelProps> = ({ streamId, onViewerCountChange })
}} }}
alt="User Avatar" alt="User Avatar"
className="w-full h-full object-cover" className="w-full h-full object-cover"
style={{ width: "2.5em", height: "2.5em", backgroundColor: 'white' }} style={{ width: "2.5em", height: "2.5em", backgroundColor: "white" }}
/> />
</div> </div>

View File

@@ -24,10 +24,9 @@ def handle_join(data) -> None:
""" """
Allow a user to join the chat of the stream they are watching. Allow a user to join the chat of the stream they are watching.
""" """
print(data, flush=True)
stream_id = data.get("stream_id") stream_id = data.get("stream_id")
if stream_id: if stream_id:
user_id = get_user_id(data["username"]) user_id = data["user_id"]
if user_id: if user_id:
add_favourability_entry(str(user_id), str(stream_id)) add_favourability_entry(str(user_id), str(stream_id))
join_room(stream_id) join_room(stream_id)
@@ -46,13 +45,12 @@ def handle_leave(data) -> None:
""" """
Handle what happens when a user leaves the stream they are watching in regards to the chat. Handle what happens when a user leaves the stream they are watching in regards to the chat.
""" """
print(data, flush=True)
stream_id = data.get("stream_id") stream_id = data.get("stream_id")
user_id = data.get("user_id") user_id = data.get("user_id")
if stream_id: if stream_id:
leave_room(stream_id) leave_room(stream_id)
if user_id: if user_id:
remove_favourability_entry(data["user_id"], stream_id) remove_favourability_entry(str(data["user_id"]), str(stream_id))
num_viewers = len(list(socketio.server.manager.get_participants("/", stream_id))) num_viewers = len(list(socketio.server.manager.get_participants("/", stream_id)))
update_viewers(stream_id, num_viewers) update_viewers(stream_id, num_viewers)
emit("status", emit("status",