Implement review suggestions

This commit is contained in:
Daniel
2020-10-19 13:26:53 +02:00
parent 8502d83e27
commit a560262818
3 changed files with 72 additions and 34 deletions

View File

@@ -66,14 +66,7 @@ func updatePids() {
pidCnt++
}
// Reverse slice orders, because higher PIDs will be more likely to be searched for.
for _, slice := range newPidsByUser {
for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
slice[i], slice[j] = slice[j], slice[i]
}
}
log.Tracef("proc: updated PID table with %d entries", pidCnt)
// log.Tracef("proc: updated PID table with %d entries", pidCnt)
pidsByUserLock.Lock()
defer pidsByUserLock.Unlock()