Skip to content

Commit

Permalink
⚡ re-use errors in gatherProcess info (#3193)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlimus authored Feb 5, 2024
1 parent b873c33 commit 3823cd0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions providers/os/resources/processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
type mqlProcessInternal struct {
SocketInodesError error
SocketInodes plugin.TValue[[]int64]
processInfoError error
lock sync.Mutex
}

Expand Down Expand Up @@ -94,14 +95,20 @@ func (p *mqlProcess) gatherProcessInfo() error {
p.lock.Lock()
defer p.lock.Unlock()

if p.processInfoError != nil {
return p.processInfoError
}

conn := p.MqlRuntime.Connection.(shared.Connection)
opm, err := processes.ResolveManager(conn)
if err != nil {
p.processInfoError = err
return errors.New("cannot find process manager")
}

process, err := opm.Process(p.Pid.Data)
if err != nil {
p.processInfoError = err
return errors.New("cannot gather process details")
}

Expand Down

0 comments on commit 3823cd0

Please sign in to comment.