task_reader.go ×7

Frontier kind: Code frontier

unlabeled · c_41730b8235da

156 tests · 3403 LOC · 151 files · introduces 0 tests · 26 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges26 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
538 ranges3403 lines · 151 files · Browse complete extent
All tests (intent)
156 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: 26 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/matching/task_reader.go 24 introduced LOC · 7 ranges

Open complete file

147 case <-ctx.Done():
148 return
149 > default: task_reader.go
150 }
151
152 > select { task_reader.go
153 case <-ctx.Done():
154 return
155
156 > case <-tr.notifyC: task_reader.go
157 > batch, err := tr.getTaskBatch(ctx)
158 > tr.backlogMgr.signalIfFatal(err)
159 > if err != nil {
160 // TODO: Should we ever stop retrying on db errors?
161 if common.IsResourceExhausted(err) {
166 continue Loop
167 }
168 > tr.retrier.Reset() task_reader.go
169 >
170 > if len(batch.tasks) == 0 {
171 > tr.backlogMgr.taskAckManager.setReadLevelAfterGap(batch.readLevel)
172 > if !batch.isReadBatchDone {
173 tr.Signal()
174 }
175 > continue Loop task_reader.go
176 }
177
218 // Also return a number that can be used to update readLevel
219 // Also return a bool to indicate whether read is finished
220 > func (tr *taskReader) getTaskBatch(ctx context.Context) (*getTasksBatchResponse, error) { task_reader.go
221 > var tasks []*persistencespb.AllocatedTaskInfo
222 > readLevel := tr.backlogMgr.taskAckManager.getReadLevel()
223 > maxReadLevel := tr.backlogMgr.db.GetMaxReadLevel(subqueueZero)
224 >
225 > // counter i is used to break and let caller check whether taskqueue is still alive and needs to resume read.
226 > for i := 0; i < 10 && readLevel < maxReadLevel; i++ {
227 upper := min(readLevel+tr.backlogMgr.config.RangeSize, maxReadLevel)
228 tasks, err := tr.getTaskBatchWithRange(ctx, readLevel, upper)
240 readLevel = upper
241 }
242 > return &getTasksBatchResponse{ task_reader.go
243 > tasks: tasks,
244 > readLevel: readLevel,
245 > isReadBatchDone: readLevel == maxReadLevel,
246 > }, nil // caller will update readLevel when no task grabbed
247 }
248
go.temporal.io/server/service/matching/backlog_manager.go 2 introduced LOC · 1 range

Open complete file

114 func (c *backlogManagerImpl) signalIfFatal(err error) bool {
115 if err == nil {
116 > return false backlog_manager.go
117 > }
118 var condfail *persistence.ConditionFailedError
119 if errors.As(err, &condfail) {