Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completing unnecessary tasks at user-disconnect #23

Open
Vibhu-Agarwal opened this issue Jul 30, 2022 · 0 comments
Open

Completing unnecessary tasks at user-disconnect #23

Vibhu-Agarwal opened this issue Jul 30, 2022 · 0 comments

Comments

@Vibhu-Agarwal
Copy link
Contributor

Hedwig/messaging.py

Lines 76 to 79 in 1e2cbf1

await asyncio.gather(*self.save_msg_in_db_tasks)
self.save_msg_in_db_tasks.clear()
for task in self.reader_tasks:
task.done()

Here, only user is disconnecting. Not even the chat-room is shutting down.
Here, save_msg_in_db_tasks and reader_tasks, both store data for all users there are, and so this is processing for all users' data, not just the one which is disconnecting.

Efficient Solution: Process only those tasks which are created by the disconnecting user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant