When using mattericd's default threading, the msgMap is populated with message/thread IDs and never removed. This means that when we cycle past 4k, we can have entries with duplicate counters causing issues where replies could end up to an incorrect thread.
This fixes it by introducing an index with the counter and to which message/thread ID. When index entries are updated and the thread no longer referenced, the entries in the msgMap are removed.
This also ensures that msgMap remains a constant bounded size.
When using mattericd's default threading, the msgMap is populated with message/thread IDs and never removed. This means that when we cycle past 4k, we can have entries with duplicate counters causing issues where replies could end up to an incorrect thread.
This fixes it by introducing an index with the counter and to which message/thread ID. When index entries are updated and the thread no longer referenced, the entries in the msgMap are removed.
This also ensures that msgMap remains a constant bounded size.
It should be noted that this also relies on https://github.com/42wim/matterircd/pull/544, in particular https://github.com/42wim/matterircd/blob/master/mm-go-irckit/server_commands.go#L665