MM-52600: [Shared Channels] Shared channels do not sync channel membership (#30976)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0082e3e94d
Коммит
fa1c77d9b0
@@ -277,3 +277,41 @@ func (scs *Service) CheckCanInviteToSharedChannel(channelId string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// updateMembershipSyncCursor updates the LastMembersSyncAt value for the shared channel remote
|
||||
// This provides centralized and consistent cursor management
|
||||
func (scs *Service) updateMembershipSyncCursor(channelID string, remoteID string, newTimestamp int64) error {
|
||||
// Get the remote record
|
||||
scr, err := scs.server.GetStore().SharedChannel().GetRemoteByIds(channelID, remoteID)
|
||||
if err != nil {
|
||||
scs.server.Log().Log(mlog.LvlSharedChannelServiceError, "Failed to get shared channel remote for cursor update",
|
||||
mlog.String("channel_id", channelID),
|
||||
mlog.String("remote_id", remoteID),
|
||||
mlog.Int("timestamp", int(newTimestamp)),
|
||||
mlog.Err(err),
|
||||
)
|
||||
return fmt.Errorf("failed to get shared channel remote for cursor update: %w", err)
|
||||
}
|
||||
|
||||
if scr == nil {
|
||||
scs.server.Log().Log(mlog.LvlSharedChannelServiceError, "Shared channel remote not found for cursor update",
|
||||
mlog.String("channel_id", channelID),
|
||||
mlog.String("remote_id", remoteID),
|
||||
)
|
||||
return fmt.Errorf("shared channel remote not found for channel %s and remote %s", channelID, remoteID)
|
||||
}
|
||||
|
||||
// Update the cursor - the store will handle ensuring it only moves forward
|
||||
err = scs.server.GetStore().SharedChannel().UpdateRemoteMembershipCursor(scr.Id, newTimestamp)
|
||||
if err != nil {
|
||||
scs.server.Log().Log(mlog.LvlSharedChannelServiceError, "Failed to update membership cursor",
|
||||
mlog.String("channel_id", channelID),
|
||||
mlog.String("remote_id", remoteID),
|
||||
mlog.String("remote_record_id", scr.Id),
|
||||
mlog.Int("timestamp", int(newTimestamp)),
|
||||
mlog.Err(err),
|
||||
)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user