Interception of repeated save

This commit is contained in:
marmei
2019-09-04 20:12:26 +02:00
parent 18dba46c02
commit c6e74fe11c
3 changed files with 57 additions and 4 deletions

View File

@@ -454,8 +454,40 @@ func saveXEpgMapping(request RequestStruct) (err error) {
Data.XEPG.Channels = request.EpgMapping
cleanupXEPG()
buildXEPG(true)
if System.ScanInProgress == 0 {
cleanupXEPG()
buildXEPG(true)
} else {
// Wenn während des erstellen der Datanbank das Mapping erneut gespeichert wird, wird die Datenbank erst später erneut aktualisiert.
go func() {
if System.BackgroundProcess == true {
return
}
System.BackgroundProcess = true
for {
time.Sleep(time.Duration(1) * time.Second)
fmt.Println("Scan", System.ScanInProgress)
if System.ScanInProgress == 0 {
break
}
}
cleanupXEPG()
buildXEPG(false)
System.BackgroundProcess = false
}()
}
return
}