Add GetOrFindPrimaryProcess to correctly group process/threads
This commit is contained in:
@@ -94,13 +94,27 @@ func CleanProcessStorage(thresholdDuration time.Duration) {
|
||||
defer processesLock.Unlock()
|
||||
|
||||
threshold := time.Now().Add(-thresholdDuration).Unix()
|
||||
|
||||
// clean primary processes
|
||||
for _, p := range processes {
|
||||
p.Lock()
|
||||
if p.FirstCommEstablished < threshold && p.CommCount == 0 {
|
||||
if !p.Virtual && p.LastCommEstablished < threshold && p.CommCount == 0 {
|
||||
go p.Delete()
|
||||
}
|
||||
p.Unlock()
|
||||
}
|
||||
|
||||
// clean virtual processes
|
||||
for _, p := range processes {
|
||||
p.Lock()
|
||||
if p.Virtual {
|
||||
_, parentIsAlive := processes[p.ParentPid]
|
||||
if !parentIsAlive {
|
||||
go p.Delete()
|
||||
}
|
||||
}
|
||||
p.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
// SetDBController sets the database controller and allows the package to push database updates on a save. It must be set by the package that registers the "network" database.
|
||||
|
||||
Reference in New Issue
Block a user