fair_task_reader.go ×5

Frontier kind: Code frontier

unlabeled · c_6d4dfd29e940

34 tests · 4218 LOC · 157 files · introduces 0 tests · 36 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges36 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
770 ranges4218 lines · 157 files · Browse complete extent
All tests (intent)
34 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: 36 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/matching/fair_task_reader.go 24 introduced LOC · 5 ranges

Open complete file

668 return
669 }
670 > tr.inGC = true fair_task_reader.go
671 > tr.lastGCTime = time.Now()
672 > // gc in new goroutine so poller doesn't have to wait
673 > go tr.doGC(tr.ackLevel)
674 }
675
683
684 // called in new goroutine
685 > func (tr *fairTaskReader) doGC(ackLevel fairLevel) { fair_task_reader.go
686 > rowsDeleted, err := tr.doGCAt(ackLevel)
687 >
688 > tr.lock.Lock()
689 > defer tr.lock.Unlock()
690 >
691 > tr.inGC = false
692 > if err != nil {
693 return
694 }
696 // - unit test, cassandra: always return UnknownNumRowsAffected (in this case means "all")
697 // - sql: return number of rows affected (should be <= batchSize)
698 > if rowsDeleted == persistence.UnknownNumRowsAffected { fair_task_reader.go
699 > tr.numToGC = 0
700 > } else {
701 tr.numToGC = max(0, tr.numToGC-rowsDeleted)
702 }
703 }
704
705 > func (tr *fairTaskReader) doGCAt(ackLevel fairLevel) (int, error) { fair_task_reader.go
706 > batchSize := tr.backlogMgr.config.MaxTaskDeleteBatchSize()
707 >
708 > ctx, cancel := context.WithTimeout(tr.backlogMgr.tqCtx, ioTimeout)
709 > defer cancel()
710 >
711 > n, err := tr.backlogMgr.db.CompleteFairTasksLessThan(ctx, ackLevel.inc(), batchSize, tr.subqueue)
712 > if err != nil {
713 tr.logger.Warn("failed to gc tasks", tag.Error(err))
714 }
715 > return n, err fair_task_reader.go
716 }
717
go.temporal.io/server/service/matching/db.go 12 introduced LOC · 2 ranges

Open complete file

768 limit int,
769 subqueue subqueueIndex,
770 > ) (int, error) { db.go
771 > n, err := db.store.CompleteTasksLessThan(ctx, &persistence.CompleteTasksLessThanRequest{
772 > NamespaceID: db.queue.NamespaceId(),
773 > TaskQueueName: db.queue.PersistenceName(),
774 > TaskType: db.queue.TaskType(),
775 > ExclusiveMaxPass: exclusiveMaxLevel.pass,
776 > ExclusiveMaxTaskID: exclusiveMaxLevel.id,
777 > Subqueue: int(subqueue),
778 > Limit: limit,
779 > })
780 > if err != nil {
781 db.logger.Error("Persistent store operation failure",
782 tag.StoreOperationCompleteTasksLessThan,
787 )
788 }
789 > return n, err db.go
790 }
791