cancellation_tasks.go ×5

Frontier kind: Code frontier

unlabeled · c_a32bc1e61d58

13 tests · 2981 LOC · 139 files · introduces 0 tests · 42 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges42 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
526 ranges2981 lines · 139 files · Browse complete extent
All tests (intent)
13 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

3 files ranked by introduced lines: 42 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/chasm/lib/nexusoperation/cancellation_tasks.go 35 introduced LOC · 5 ranges

Open complete file

122 }
123
124 > callTimeout := h.config.RequestTimeout(ns.Name().String(), attrs.Destination) cancellation_tasks.go
125 > var timeoutType enumspb.TimeoutType
126 > if args.startToCloseTimeout > 0 {
127 if t := args.startToCloseTimeout - args.currentTime.Sub(args.startedTime); t < callTimeout {
128 callTimeout = t
130 }
131 }
132 > if args.scheduleToCloseTimeout > 0 { cancellation_tasks.go
133 if t := args.scheduleToCloseTimeout - args.currentTime.Sub(args.scheduledTime); t < callTimeout {
134 callTimeout = t
137 }
138
139 > callCtx, cancel := h.setupCallContext(ctx, callTimeout) cancellation_tasks.go
140 > defer cancel()
141 >
142 > traceCtx := invocationTraceContext{
143 > operationTag: "CancelOperation",
144 > namespaceName: ns.Name().String(),
145 > targetNamespaceID: endpoint.GetEndpoint().GetSpec().GetTarget().GetWorker().GetNamespaceId(),
146 > requestID: args.requestID,
147 > operation: args.operation,
148 > endpointName: args.endpointName,
149 > workflowID: cancelRef.BusinessID,
150 > runID: cancelRef.RunID,
151 > attemptStart: args.currentTime.UTC(),
152 > attempt: task.GetAttempt(),
153 > }
154 >
155 > inv, err := h.newInvocation(
156 > callCtx, ns, endpoint, args.endpointName, args.service,
157 > callTimeout, timeoutType, traceCtx,
158 > )
159 > if err != nil {
160 return fmt.Errorf("failed to construct invocation: %w", err)
161 }
162 > startTime := time.Now() // nolint:forbidigo // Time can be used for timing metrics. cancellation_tasks.go
163 > callErr := inv.Cancel(callCtx, args, nexus.CancelOperationOptions{Header: nexus.Header(args.headers)})
164 > failureSource := failureSourceFromContext(callCtx)
165 >
166 > h.recordCallOutcome(endpoint, cancelCallOutcomeTag(callCtx, callErr), callErr, time.Since(startTime), failureSource, traceCtx)
167 >
168 > saveErr := h.saveCancellationResult(ctx, cancelRef, callErr)
169 >
170 > if callErr != nil && isDestinationDown(callErr) {
171 saveErr = queueserrors.NewDestinationDownError(callErr.Error(), saveErr)
172 }
173
174 > return saveErr cancellation_tasks.go
175 }
176
go.temporal.io/server/chasm/lib/nexusoperation/task_handler_base.go 5 introduced LOC · 1 range

Open complete file

161
162 // setupCallContext creates a context with a timeout and attaches the failure source tracking value.
163 > func (b *nexusTaskHandlerBase) setupCallContext(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc) { task_handler_base.go
164 > callCtx, cancel := context.WithTimeout(ctx, timeout)
165 > callCtx = context.WithValue(callCtx, commonnexus.FailureSourceContextKey, &atomic.Value{})
166 > return callCtx, cancel
167 > }
168
169 // recordCallOutcome records metrics and logs errors for the outcome of an outbound Nexus call.
go.temporal.io/server/chasm/lib/nexusoperation/task_handler_helpers.go 2 introduced LOC · 1 range

Open complete file

116
117 // cancelCallOutcomeTag returns a metric tag for the outcome of a cancel call.
118 > func cancelCallOutcomeTag(callCtx context.Context, callErr error) string { task_handler_helpers.go
119 > if callErr != nil {
120 if errors.Is(callErr, errOpProcessorFailed) {
121 return "operation-processor-failed"