summaryrefslogtreecommitdiff
path: root/pkg/process
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-07-11 10:11:22 +0300
committerValery Piashchynski <[email protected]>2021-07-11 10:11:22 +0300
commit589f759cc2411319adbca2ece0dbe212407d1eba (patch)
tree2fbea4a6033d65813c41fd80f6339a524b46c9b2 /pkg/process
parentcb2665d93ad7abe1ab30508ff0e2bd4d0bc379ea (diff)
Update informer interface to return slice of pointers (do not over-copy
the Stat structure). Make amqp Push concurrent safe. Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg/process')
-rw-r--r--pkg/process/state.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/process/state.go b/pkg/process/state.go
index 652ec77c..bfc3a287 100644
--- a/pkg/process/state.go
+++ b/pkg/process/state.go
@@ -32,20 +32,20 @@ type State struct {
}
// WorkerProcessState creates new worker state definition.
-func WorkerProcessState(w worker.BaseProcess) (State, error) {
+func WorkerProcessState(w worker.BaseProcess) (*State, error) {
const op = errors.Op("worker_process_state")
p, _ := process.NewProcess(int32(w.Pid()))
i, err := p.MemoryInfo()
if err != nil {
- return State{}, errors.E(op, err)
+ return nil, errors.E(op, err)
}
percent, err := p.CPUPercent()
if err != nil {
- return State{}, err
+ return nil, err
}
- return State{
+ return &State{
CPUPercent: percent,
Pid: int(w.Pid()),
Status: w.State().String(),