Fix reply rendering infinite loop bug

This commit is contained in:
Tulir Asokan
2019-06-16 14:29:03 +03:00
parent 6bb932212c
commit 2b7d5d5401
7 changed files with 17 additions and 10 deletions

View File

@ -29,7 +29,9 @@ import (
"path"
"path/filepath"
"regexp"
"runtime"
"time"
dbg "runtime/debug"
"maunium.net/go/mautrix"
"maunium.net/go/mautrix/format"
@ -232,6 +234,11 @@ func (c *Container) OnLogin() {
debug.Print("Adding rooms to UI")
c.ui.MainView().SetRooms(c.config.Rooms)
c.ui.Render()
// The initial sync can be a bit heavy, so we force run the GC here
// after cleaning up rooms from memory above.
debug.Print("Running GC")
runtime.GC()
dbg.FreeOSMemory()
}
c.client.Syncer = c.syncer

View File

@ -148,6 +148,9 @@ func (room *Room) Load() {
room.lock.Lock()
room.load()
room.lock.Unlock()
if room.postLoad != nil {
room.postLoad()
}
}
func (room *Room) load() {
@ -177,9 +180,6 @@ func (room *Room) load() {
debug.Print("Failed to decode room state:", err)
}
room.changed = false
if room.postLoad != nil {
room.postLoad()
}
}
func (room *Room) Touch() {