Skip to content

Commit

Permalink
backfill: enable aggressive deduplication for forward backfills
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Aug 28, 2024
1 parent 16b2fb6 commit 6abf636
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v3 v3.0.1
maunium.net/go/mautrix v0.20.1-0.20240827191023-f56905a27645
maunium.net/go/mautrix v0.20.1-0.20240828131827-fd89457be8f4
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M=
maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA=
maunium.net/go/mautrix v0.20.1-0.20240827191023-f56905a27645 h1:44YDJap8wHIHJV3dt4ZIojQnnlIEd60Beh8fFP7Xsz4=
maunium.net/go/mautrix v0.20.1-0.20240827191023-f56905a27645/go.mod h1:7hh/Hx5W9lUcqL0hkSw52kMyY+6nMUPTtdDN0qVEXwI=
maunium.net/go/mautrix v0.20.1-0.20240828131827-fd89457be8f4 h1:zNdM+RYEJs4nbpvtM0uXuppM45h3hwa9x+iDYdSEeHc=
maunium.net/go/mautrix v0.20.1-0.20240828131827-fd89457be8f4/go.mod h1:7hh/Hx5W9lUcqL0hkSw52kMyY+6nMUPTtdDN0qVEXwI=
1 change: 1 addition & 0 deletions pkg/connector/backfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (gc *GMClient) FetchMessages(ctx context.Context, params bridgev2.FetchMess
}
fetchResp.HasMore = len(fetchResp.Messages) > 0
if params.Forward {
fetchResp.AggressiveDeduplication = params.AnchorMessage != nil
gc.conversationMetaLock.Lock()
meta := gc.conversationMeta[convID]
if meta != nil {
Expand Down
4 changes: 3 additions & 1 deletion pkg/connector/chatsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ func (evt *GMChatResync) CheckNeedsBackfill(ctx context.Context, latestMessage *
return false, nil
}
lastMessageTS := time.UnixMicro(evt.Conv.LastMessageTimestamp)
return evt.Conv.LastMessageTimestamp != 0 && (latestMessage == nil || lastMessageTS.After(latestMessage.Timestamp)), nil
return evt.Conv.LastMessageTimestamp != 0 && (latestMessage == nil ||
(lastMessageTS.After(latestMessage.Timestamp) &&
evt.g.MakeMessageID(evt.Conv.LatestMessageID) != latestMessage.ID)), nil
}

func (evt *GMChatResync) DeleteOnlyForMe() bool {
Expand Down

0 comments on commit 6abf636

Please sign in to comment.