[service] Make linter happy
This commit is contained in:
@@ -9,6 +9,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestDebug(t *testing.T) {
|
func TestDebug(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
// Create test instance with at least one worker.
|
// Create test instance with at least one worker.
|
||||||
i := &Instance{}
|
i := &Instance{}
|
||||||
n, err := notifications.New(i)
|
n, err := notifications.New(i)
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ const (
|
|||||||
groupStateInvalid
|
groupStateInvalid
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//nolint:goconst
|
||||||
func groupStateToString(state int32) string {
|
func groupStateToString(state int32) string {
|
||||||
switch state {
|
switch state {
|
||||||
case groupStateOff:
|
case groupStateOff:
|
||||||
|
|||||||
@@ -176,7 +176,8 @@ func (m *Manager) WorkerInfo(s *stack.Snapshot) (*WorkerInfo, error) {
|
|||||||
"waiting", "dead", "enqueue", "copystack":
|
"waiting", "dead", "enqueue", "copystack":
|
||||||
wi.Running++
|
wi.Running++
|
||||||
case "chan send", "chan receive", "select", "IO wait",
|
case "chan send", "chan receive", "select", "IO wait",
|
||||||
"panicwait", "semacquire", "semarelease", "sleep":
|
"panicwait", "semacquire", "semarelease", "sleep",
|
||||||
|
"sync.Mutex.Lock":
|
||||||
wi.Waiting++
|
wi.Waiting++
|
||||||
case "":
|
case "":
|
||||||
if w.workerMgr != nil {
|
if w.workerMgr != nil {
|
||||||
@@ -213,10 +214,10 @@ func (wi *WorkerInfo) Format() string {
|
|||||||
|
|
||||||
// Build table.
|
// Build table.
|
||||||
tabWriter := tabwriter.NewWriter(buf, 4, 4, 3, ' ', 0)
|
tabWriter := tabwriter.NewWriter(buf, 4, 4, 3, ' ', 0)
|
||||||
fmt.Fprintf(tabWriter, "#\tState\tModule\tName\tWorker Func\tCurrent Line\tExtra Info\n")
|
_, _ = fmt.Fprintf(tabWriter, "#\tState\tModule\tName\tWorker Func\tCurrent Line\tExtra Info\n")
|
||||||
|
|
||||||
for _, wd := range wi.Workers {
|
for _, wd := range wi.Workers {
|
||||||
fmt.Fprintf(tabWriter,
|
_, _ = fmt.Fprintf(tabWriter,
|
||||||
"%d\t%s\t%s\t%s\t%s\t%s\t%s\n",
|
"%d\t%s\t%s\t%s\t%s\t%s\t%s\n",
|
||||||
wd.Count,
|
wd.Count,
|
||||||
wd.State,
|
wd.State,
|
||||||
@@ -365,13 +366,14 @@ func workerDetailsAreEqual(a, b *WorkerInfoDetail) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:goconst
|
||||||
func goroutineStateOrder(state string) int {
|
func goroutineStateOrder(state string) int {
|
||||||
switch state {
|
switch state {
|
||||||
case "runnable", "running", "syscall":
|
case "runnable", "running", "syscall":
|
||||||
return 0 // Active.
|
return 0 // Active.
|
||||||
case "idle", "waiting", "dead", "enqueue", "copystack":
|
case "idle", "waiting", "dead", "enqueue", "copystack":
|
||||||
return 1 // Active-ish.
|
return 1 // Active-ish.
|
||||||
case "semacquire", "semarelease", "sleep", "panicwait":
|
case "semacquire", "semarelease", "sleep", "panicwait", "sync.Mutex.Lock":
|
||||||
return 2 // Bad (practice) blocking.
|
return 2 // Bad (practice) blocking.
|
||||||
case "chan send", "chan receive", "select":
|
case "chan send", "chan receive", "select":
|
||||||
return 3 // Potentially bad (practice), but normal blocking.
|
return 3 // Potentially bad (practice), but normal blocking.
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ manage:
|
|||||||
workerMgr: s,
|
workerMgr: s,
|
||||||
logger: s.ctx.logger,
|
logger: s.ctx.logger,
|
||||||
}
|
}
|
||||||
|
//nolint:fatcontext // Every run gets a new context.
|
||||||
wCtx.ctx, wCtx.cancelCtx = context.WithCancel(s.ctx.ctx)
|
wCtx.ctx, wCtx.cancelCtx = context.WithCancel(s.ctx.ctx)
|
||||||
panicInfo, err := s.mgr.runWorker(wCtx, s.fn)
|
panicInfo, err := s.mgr.runWorker(wCtx, s.fn)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user