Improve performance, logging

This commit is contained in:
Daniel
2019-05-10 11:57:51 +02:00
parent e72ed023db
commit 16db10b84b
9 changed files with 282 additions and 129 deletions

View File

@@ -60,7 +60,7 @@ func (p *Process) Save() {
processesLock.Unlock()
}
if dbControllerFlag.IsSet() {
if dbControllerFlag.IsSet() && p.Error == "" {
go dbController.PushUpdate(p)
}
}
@@ -109,10 +109,15 @@ func CleanProcessStorage(thresholdDuration time.Duration) {
}
}
// clean virtual processes
// clean virtual/failed processes
for _, p := range processesCopy {
p.Lock()
if p.Virtual {
switch {
case p.Error != "":
if p.Meta().Created < threshold {
delete = true
}
case p.Virtual:
_, parentIsAlive := processes[p.ParentPid]
if !parentIsAlive {
delete = true