Random changes

This commit is contained in:
Tulir Asokan 2020-05-06 23:30:16 +03:00
parent 6cf22290ad
commit 03826346d9
2 changed files with 6 additions and 4 deletions

View File

@ -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()

View File

@ -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)