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

Clear mark-as-read queue when active account changes #5557

Open
gnprice opened this issue Nov 17, 2022 · 0 comments
Open

Clear mark-as-read queue when active account changes #5557

gnprice opened this issue Nov 17, 2022 · 0 comments
Labels
a-data-sync Zulip's event system, event queues, staleness/liveness a-multi-org P1 high-priority

Comments

@gnprice
Copy link
Member

gnprice commented Nov 17, 2022

@chrisbobbe pointed out on #5552 that in queueMarkAsRead.js, where we keep a queue of messages the user wants to mark as read:

[…] there's also the flaw where we're storing per-account state at a module's toplevel:

let unsentMessageIds: number[] = [];
let lastSentTime = -Infinity;
let timeout = null;

This is similar to #5009, in that it means that we have ongoing activity which is meant for the particular account that's currently active, and when the active account changes we may start treating it as if it were meant for the new active account.

Instead, much like the solution described in #5009: when we go to process this queue, we should check if the account we're about to act for is the same one that the existing queue was meant for, if it's nonempty. If not, we should discard the existing contents of the queue.

In the future as part of #5005, this will naturally get resolved because we'll have potentially several mark-as-read queues active where we're trying to mark messages as read on several different accounts. But there's no need to wait for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-data-sync Zulip's event system, event queues, staleness/liveness a-multi-org P1 high-priority
Projects
None yet
Development

No branches or pull requests

1 participant