Fixed race condition
This commit is contained in:
parent
690666c94a
commit
1d89cbf698
1 changed files with 3 additions and 13 deletions
16
file.go
16
file.go
|
@ -54,6 +54,9 @@ func saveBayesToFile() {
|
|||
|
||||
writeToFile(dumpfile+"stats.json", statsREPORT)
|
||||
|
||||
ZClassifier.Learning.busy.Lock()
|
||||
defer ZClassifier.Learning.busy.Unlock()
|
||||
|
||||
badScores, err := json.MarshalIndent(ZClassifier.Learning.bayez.datas[Bad], "", " ")
|
||||
if err != nil {
|
||||
badScores = []byte(err.Error())
|
||||
|
@ -71,19 +74,6 @@ func saveBayesToFile() {
|
|||
|
||||
log.Println(string(goodScores))
|
||||
|
||||
// dumpfile := os.Getenv("DUMPFILE")
|
||||
// if dumpfile == "" {
|
||||
// dumpfile = "bayes.json"
|
||||
// }
|
||||
|
||||
// if DebugLog {
|
||||
// log.Println("DUMP: ", string(tmpJSON)+statsREPORT)
|
||||
// } else {
|
||||
// writeToFile(dumpfile, string(tmpJSON)+statsREPORT)
|
||||
//
|
||||
// log.Println("File saved: ", dumpfile)
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
func jsonEngine() {
|
||||
|
|
Loading…
Reference in a new issue