diff options
author | Tulir Asokan <tulir@maunium.net> | 2020-05-06 23:30:16 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2020-05-06 23:30:16 +0300 |
commit | 03826346d9bbe44f32e868e18d0367949b518361 (patch) | |
tree | e7767f8d24336ab121691d677f78fdbb714bf1ff | |
parent | 6cf22290ad6a471fa7556ad84d5c70862fa7726c (diff) |
Random changes
-rw-r--r-- | matrix/rooms/roomcache.go | 4 | ||||
-rw-r--r-- | ui/commands.go | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/matrix/rooms/roomcache.go b/matrix/rooms/roomcache.go index 067cbb6..5af0c5b 100644 --- a/matrix/rooms/roomcache.go +++ b/matrix/rooms/roomcache.go @@ -139,11 +139,11 @@ func (cache *RoomCache) LoadList() error { func (cache *RoomCache) SaveLoadedRooms() { cache.Lock() - defer cache.Unlock() cache.clean(false) for node := cache.head; node != nil; node = node.prev { node.Save() } + cache.Unlock() } func (cache *RoomCache) SaveList() error { @@ -193,7 +193,7 @@ func (cache *RoomCache) Touch(roomID id.RoomID) { } func (cache *RoomCache) TouchNode(node *Room) { - if cache.noUnload || node.touch + 2 > time.Now().Unix() { + if cache.noUnload || node.touch+2 > time.Now().Unix() { return } cache.Lock() diff --git a/ui/commands.go b/ui/commands.go index 4dd1482..02d2a3d 100644 --- a/ui/commands.go +++ b/ui/commands.go @@ -263,8 +263,10 @@ func cmdRoomNick(cmd *Command) { } func cmdHeapProfile(cmd *Command) { - runtime.GC() - dbg.FreeOSMemory() + if len(cmd.Args) == 0 || cmd.Args[0] != "nogc" { + runtime.GC() + dbg.FreeOSMemory() + } memProfile, err := os.Create("gomuks.heap.prof") if err != nil { debug.Print("Failed to open gomuks.heap.prof:", err) |