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

Always use stored last viewed at if present #424

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions mm-go-irckit/userbridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,13 +591,15 @@ func (u *User) addUserToChannelWorker(channels <-chan *bridge.ChannelInfo, throt
if since == 0 {
continue
}
// We used to stored last viewed at if present.

// We use the stored LastViewedAt if present as we can't
// always trust that the Mattermost server has updated the
// last viewed at for the channel. This ensures we receive
// *all* msgs missed since matterircd was last
// running/connected (PR#361).
u.lastViewedAtMutex.RLock()
if lastViewedAt, ok := u.lastViewedAt[brchannel.ID]; ok {
// But only use the stored last viewed if it's later than what the server knows.
if lastViewedAt > since {
since = lastViewedAt + 1
}
since = lastViewedAt + 1
}
u.lastViewedAtMutex.RUnlock()
// post everything to the channel you haven't seen yet
Expand Down