Page MenuHomePhabricator

Fix DM activity handler not to send unnecessary read status update
Needs ReviewPublic

Authored by marcin on Wed, Sep 18, 7:36 AM.
Tags
None
Referenced Files
F2762834: D13383.id44314.diff
Thu, Sep 19, 10:07 AM
F2762511: D13383.id44345.diff
Thu, Sep 19, 9:48 AM
F2760628: D13383.diff
Thu, Sep 19, 6:46 AM
F2759640: D13383.diff
Thu, Sep 19, 5:24 AM
Subscribers
None

Details

Reviewers
ashoat
tomek
kamil
Summary

This differential prevents DM activity handler from spamming unread status unpdates by sending updates only for threads that are unread when we enter them and using debouncing when receiving messages to currently active thread.

Test Plan
  1. Add console log to each portion of sent dm's
  2. Ensure that when entering thick thread updates are sent once only if the thread was unread.
  3. Ensuure that after receiving stream of messages to thick thread, unread updates are sent only once 5 seconds after the last message.

Diff Detail

Repository
rCOMM Comm
Branch
marcin/eng-9267
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

lib/handlers/dm-activity-handler.js
89 ↗(On Diff #44314)

If there is pending debounced call from previous active thread we want to call it right now.

110 ↗(On Diff #44314)

Checking for change in latest message makes sense only if we are in the same thread.

web/redux/redux-setup.js
460 ↗(On Diff #44314)

This code was changing thick thread read status before dm activity handler could detect change and send necessary updates.

tomek requested changes to this revision.Thu, Sep 19, 3:02 AM

This solution feels a lot more complicated than it should. Maybe it has to be that complicated, with canceling and flushing, but I'm not sure.

Would it be possible to have a memo, with activeThread as a dependency, where we store the denounced function and then simply call this function in an effect, without canceling and flushing?

This revision now requires changes to proceed.Thu, Sep 19, 3:02 AM