statemachine.go ×3

Frontier kind: Code frontier

unlabeled · c_09a7aaba3b8a

6 tests · 2479 LOC · 120 files · introduces 0 tests · 27 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges27 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
382 ranges2479 lines · 120 files · Browse complete extent
All tests (intent)
6 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.

2 files ranked by introduced lines: 27 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/chasm/lib/activity/statemachine.go 15 introduced LOC · 3 ranges

Open complete file

101 },
102 activitypb.ACTIVITY_EXECUTION_STATUS_SCHEDULED,
103 > func(a *Activity, ctx chasm.MutableContext, event rescheduleEvent) error { statemachine.go
104 > if err := a.applyFailedAttempt(ctx, event); err != nil {
105 return err
106 }
107
108 > attempt := a.LastAttempt.Get(ctx) statemachine.go
109 > retryScheduledTime := dispatchTimeForRetry(attempt).AsTime()
110 > attempt.DispatchTime = timestamppb.New(retryScheduledTime)
111 >
112 > if timeout := a.GetScheduleToStartTimeout().AsDuration(); timeout > 0 {
113 ctx.AddTask(
114 a,
121 }
122
123 > ctx.AddTask( statemachine.go
124 > a,
125 > chasm.TaskAttributes{
126 > ScheduledTime: retryScheduledTime,
127 > },
128 > a.newActivityDispatchTask(ctx))
129 >
130 > return nil
131 },
132 )
go.temporal.io/server/chasm/lib/activity/activity.go 12 introduced LOC · 2 ranges

Open complete file

349 // dispatchTimeForRetry computes the time a retried attempt will be dispatched to Matching,
350 // as complete_time + retry_interval. Returns nil if either field is missing or zero.
351 > func dispatchTimeForRetry(attempt *activitypb.ActivityAttemptState) *timestamppb.Timestamp { activity.go
352 > retryInterval := attempt.GetCurrentRetryInterval()
353 > completeTime := attempt.GetCompleteTime()
354 > if retryInterval != nil && retryInterval.AsDuration() > 0 && completeTime != nil {
355 > return timestamppb.New(completeTime.AsTime().Add(retryInterval.AsDuration()))
356 > }
357 return nil
358 }
1273
1274 // applyFailedAttempt mutates activity state when a worker yields with retries remaining.
1275 > func (a *Activity) applyFailedAttempt(ctx chasm.MutableContext, event rescheduleEvent) error { activity.go
1276 > attempt := a.LastAttempt.Get(ctx)
1277 > attempt.Count++
1278 > attempt.Stamp++
1279 > return a.recordFailedAttempt(ctx, event.retryInterval, event.retryIntervalSource, event.failure, ctx.Now(a), false)
1280 > }
1281
1282 // recordFailedAttempt records any failures resulting from a tried attempt, including worker application failures and