channels: drop stale membership caches on join/leave
After channels.leaveChannel, a client that polls channels.getFullChannel kept receiving a projection that still showed it as an active member (left=false) until the per-(viewer,channel) RPC projection cache and the store-level member cache lapsed on their own or the async read-model NOTIFY landed. The client therefore kept an open compose box while every send was already rejected with CHANNEL_PRIVATE - most visible on public forum supergroups, where getFullChannel keeps succeeding via the preview path instead of tearing the chat down. Every other membership-mutating path already busts these caches synchronously; join/leave/invite/request-approval did not. Add: - store: invalidateChannelMembershipCaches (row + member + dialog caches), called post-commit from JoinChannel, LeaveChannel, ImportInvite, InviteToChannel. - rpc: invalidateChannelMembershipProjection (channelFullProjectionCache pair), called from the join/leave/invite/hide-requests handlers for every user whose membership changed.
This commit is contained in:
parent
2c782aab95
commit
55a6e0bb35
7 changed files with 116 additions and 0 deletions
|
|
@ -103,6 +103,7 @@ func (s *ChannelStore) ImportInvite(ctx context.Context, req domain.ImportChanne
|
|||
return domain.CreateChannelResult{}, fmt.Errorf("commit import channel invite: %w", err)
|
||||
}
|
||||
committed = true
|
||||
s.invalidateChannelMembershipCaches(result.Channel.ID, req.UserID)
|
||||
recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, result.Channel.ID, 0)
|
||||
result.Recipients = recipients
|
||||
return result, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue