42wim/matterircd

Limit replayed messages

Closed this issue · 3 comments

After a reconnection to our mattermost server, matterircd requested a slightly insane amount of backlog:

Dec 02 12:41:47 quassel matterircd[10814]: time="2022-12-02T12:41:47Z" level=info msg="Replaying msgs for waveform for #launchpad (9upbffgpgtnomf71iydt9sh1xh) since 2022-03-14 16:23:46 (server)" module=matterircd
...
Dec 02 12:41:50 quassel matterircd[10814]: time="2022-12-02T12:41:50Z" level=info msg="Replaying msgs for waveform for #server (cpwajfqteibjfcpoe5yq5ezuhc) since 2022-02-10 12:00:34 (server)" module=matterircd
Dec 02 12:41:53 quassel matterircd[10814]: time="2022-12-02T12:41:53Z" level=info msg="Replaying msgs for waveform for #is-outage (64ynnicwuidztbqprd5mizp5dh) since 2021-05-26 17:19:36 (server)" module=matterircd

i.e. it's requesting over a year of backlog from our is-outage channel, 9 months from launchpad, and so on. Could a limit be placed on the retrieval by default, say a week or so? I'm not sure why matterircd thinks I haven't viewed those channels for so long but retrieving that amount of backlog caused some issues in my postgres backend :)

The "(server)" bit at the end of those logging lines means it's using what the Mattermost server knows as when you last viewed a channel. See - https://github.com/42wim/matterircd/blob/master/mm-go-irckit/userbridge.go#L664

Can I ask what version of matterircd you're running? Do you have LastViewedSaveFile set in matterircd.toml?

Ah, thanks for the info!

The version of matterircd is 0.26.1 and I do have LastViewedSaveFile set in matterircd.toml. In fact, as part of trying to work around things I did try removing LastViewedSaveFile but it generated one anyway so I assumed it wasn't something that could be disabled, just customized in location. The relevant section is currently:

LastViewedSaveFile = "/home/ubuntu/matterircd-lastsaved.db"
##LastViewedSaveInterval = "5m"
##LastViewedStaleDuration = "14d"

The last two items were uncommented prior to my fiddling around with it, and would've been in effect when quassel went a bit nuts :). Personally I'm not that bothered about replaying missed events; in my setup quassel connects to matterircd so barring the odd connection failure (which are pretty rare) it's always online anyway -- hence why I was happy to attempt working around things by just disabling LastViewedSaveFile.

Yeah, LastViewedSaveFile can't be disabled but just customised in location as you've discovered. LastViewedSaveInterval and LastViewedStaleDuration isn't used anymore since the move to bbolt.

Not sure what was wrong, if it were using the saved last view, it would show up as (stored) rather than (server) when replaying messages on reconnect, provided that the stored values are newer than from the server.