MCPcopy Index your code
hub / github.com/flant/shell-operator / withLock

Method withLock

pkg/task/queue/task_queue.go:1124–1140  ·  view source on GitHub ↗
(fn func())

Source from the content-addressed store, hash-verified

1122}
1123
1124func (q *TaskQueue) withLock(fn func()) {
1125 q.m.Lock()
1126 defer func() {
1127 q.m.Unlock()
1128
1129 if r := recover(); r != nil {
1130 q.logger.Warn("panic recovered in withLock",
1131 slog.Any(pkg.LogKeyError, r),
1132 slog.String(pkg.LogKeyStack, string(debug.Stack())),
1133 slog.String(pkg.LogKeyQueue, q.Name),
1134 slog.Int(pkg.LogKeyQueueLength, q.Length()),
1135 )
1136 }
1137 }()
1138
1139 fn()
1140}
1141
1142func isNil(v interface{}) bool {
1143 if v == nil {

Callers 1

processOneMethod · 0.95

Calls 2

LengthMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected