fix: sync public channel preview updates
This commit is contained in:
parent
2289a31f46
commit
b4aaf57d6b
27 changed files with 877 additions and 128 deletions
|
|
@ -2,6 +2,7 @@ package rpc
|
|||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
|
|
@ -9,6 +10,7 @@ import (
|
|||
)
|
||||
|
||||
const channelMembershipSyncPageSize = domain.MaxSynchronousChannelDialogFanout
|
||||
const publicChannelSubscriptionTTL = 75 * time.Second
|
||||
|
||||
func (r *Router) trackChannelInterest(ctx context.Context, userID int64, channelIDs ...int64) {
|
||||
if userID == 0 || r.deps.Sessions == nil {
|
||||
|
|
@ -37,6 +39,25 @@ func (r *Router) clearChannelInterest(ctx context.Context, userID int64) {
|
|||
r.trackChannelInterest(ctx, userID)
|
||||
}
|
||||
|
||||
func (r *Router) refreshPublicChannelSubscription(ctx context.Context, userID, channelID int64) {
|
||||
if userID == 0 || channelID == 0 || r.deps.Sessions == nil {
|
||||
return
|
||||
}
|
||||
provider, ok := r.deps.Sessions.(ChannelSubscriptionProvider)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
rawAuthKeyID, ok := RawAuthKeyIDFrom(ctx)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
sessionID, ok := SessionIDFrom(ctx)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
provider.RefreshChannelSubscription(rawAuthKeyID, sessionID, userID, channelID, publicChannelSubscriptionTTL)
|
||||
}
|
||||
|
||||
func (r *Router) syncSessionChannelMemberships(ctx context.Context, userID int64) {
|
||||
if userID == 0 || r.deps.Sessions == nil || r.deps.Channels == nil {
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue