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

Remove global load position #156

Merged
merged 9 commits into from
Jun 15, 2023
5 changes: 2 additions & 3 deletions sync3/handler/connstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type ConnState struct {
// not yet seen room X's latest NID (it'll be sitting in the live buffer). This is why it's important
// that ConnState DOES NOT ignore events based on this value - it must ignore events based on the real
// load position for the room.
// If this value is negative or 0, it means that this connection has not been loaded yet.
anchorLoadPosition int64
// roomID -> latest load pos
loadPositions map[string]int64
Expand Down Expand Up @@ -99,9 +100,7 @@ func (s *ConnState) load(ctx context.Context, req *sync3.Request) error {
if err != nil {
return err
}
for roomID, nid := range loadPositions {
s.loadPositions[roomID] = nid
}
s.loadPositions = loadPositions
kegsay marked this conversation as resolved.
Show resolved Hide resolved
rooms := make([]sync3.RoomConnMetadata, len(joinedRooms))
i := 0
for _, metadata := range joinedRooms {
Expand Down