Skip to content
This repository was archived by the owner on Nov 22, 2020. It is now read-only.
This repository was archived by the owner on Nov 22, 2020. It is now read-only.

qxnw/hydra: rpc/rpc.sync.go; 16 LoC #834

Description

@githubvet

Found a possible issue in qxnw/hydra at rpc/rpc.sync.go

The below snippet of Go code triggered static analysis which searches for goroutines and/or defer statements
which capture loop variables.

Click here to see the code in its original context.

Click here to show the 17 line(s) of Go which triggered the analyzer.
	for _, v := range rs {
		go func(r rpc.IRPCResponse) {
			select {
			case <-closeCh:
				return
			case <-time.After(timeout):
				errChan <- &Result{Err: fmt.Errorf("%s请求超时(%v)", v.GetService(), timeout)}
				results = append(results, &Result{Status: 504, Err: fmt.Errorf("%s请求超时(%v)", v.GetService(), timeout)})
			case value := <-r.GetResult():
				if value.GetErr() != nil {
					errChan <- value
				}
				results = append(results, value)
			}
			atomic.AddInt32(&counter, 1)
		}(v)
	}

commit ID: 2762222302066275ff6860b210d01a7ed9a42f61

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions