Skip to content
This repository has been archived by the owner on May 8, 2022. It is now read-only.

Commit

Permalink
Clear XMLTV cache when it's no longer needed for a periodic use. Closes
Browse files Browse the repository at this point in the history
#2 .

Will result in extra disk I/O when mapping gets updated by user but RAM useage in idle mode will drop significally.
  • Loading branch information
SCP002 committed Apr 10, 2022
1 parent 51869e8 commit fb27202
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/xepg.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,7 @@ func buildXEPG(background bool) {

System.ScanInProgress = 0

// Clearing the Cache
/*
Data.Cache.XMLTV = make(map[string]XMLTV)
Data.Cache.XMLTV = nil
*/
runtime.GC()
clearXMLTVCache()

}()

Expand Down Expand Up @@ -138,10 +133,7 @@ func buildXEPG(background bool) {

System.ScanInProgress = 0

// Clearing the Cache
//Data.Cache.XMLTV = make(map[string]XMLTV)
//Data.Cache.XMLTV = nil
runtime.GC()
clearXMLTVCache()

}()

Expand Down Expand Up @@ -1106,3 +1098,9 @@ func cleanupXEPG() {

return
}

// clearXMLTVCache empties XMLTV cache and runs a garbage collector
func clearXMLTVCache() {
Data.Cache.XMLTV = make(map[string]XMLTV)
runtime.GC()
}

0 comments on commit fb27202

Please sign in to comment.