queue_immediate.go ×11

Frontier kind: Code frontier

unlabeled · c_8354b41ea473

13 tests · 5018 LOC · 212 files · introduces 0 tests · 166 LOC · 6 files

Introduces — evidence that enters the hierarchy at this concept

Code
20 ranges166 lines · 6 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
806 ranges5018 lines · 212 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.

6 files ranked by introduced lines: 166 introduced LOC across 20 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/outbound_queue_factory.go 118 introduced LOC · 5 ranges

Open complete file

187
188 // Start implements QueueFactory.
189 > func (f *outboundQueueFactory) Start() { outbound_queue_factory.go
190 > f.hostScheduler.Start()
191 > }
192
193 // Stop implements QueueFactory.
198 func (f *outboundQueueFactory) CreateQueue(
199 shardContext historyi.ShardContext,
200 > ) queues.Queue { outbound_queue_factory.go
201 > logger := log.With(shardContext.GetLogger(), tag.ComponentOutboundQueue)
202 > metricsHandler := getOutbountQueueProcessorMetricsHandler(f.MetricsHandler)
203 >
204 > currentClusterName := f.ClusterMetadata.GetCurrentClusterName()
205 >
206 > scheduler := queues.NewRateLimitedScheduler(
207 > f.hostScheduler,
208 > queues.RateLimitedSchedulerOptions{
209 > Enabled: f.Config.TaskSchedulerEnableRateLimiter,
210 > EnableShadowMode: f.Config.TaskSchedulerEnableRateLimiterShadowMode,
211 > StartupDelay: f.Config.TaskSchedulerRateLimiterStartupDelay,
212 > },
213 > currentClusterName,
214 > f.NamespaceRegistry,
215 > f.SchedulerRateLimiter,
216 > f.TimeSource,
217 > f.ChasmRegistry,
218 > logger,
219 > metricsHandler,
220 > )
221 >
222 > rescheduler := queues.NewRescheduler(
223 > scheduler,
224 > shardContext.GetTimeSource(),
225 > logger,
226 > metricsHandler,
227 > )
228 >
229 > activeExecutor := newOutboundQueueActiveTaskExecutor(
230 > shardContext,
231 > f.WorkflowCache,
232 > logger,
233 > metricsHandler,
234 > f.ChasmEngine,
235 > f.MatchingClient,
236 > )
237 >
238 > standbyExecutor := newOutboundQueueStandbyTaskExecutor(
239 > shardContext,
240 > f.WorkflowCache,
241 > currentClusterName,
242 > logger,
243 > metricsHandler,
244 > f.ChasmEngine,
245 > f.ClientBean,
246 > )
247 >
248 > executor := queues.NewActiveStandbyExecutor(
249 > currentClusterName,
250 > f.NamespaceRegistry,
251 > activeExecutor,
252 > standbyExecutor,
253 > logger,
254 > )
255 >
256 > if f.ExecutorWrapper != nil {
257 executor = f.ExecutorWrapper.Wrap(executor)
258 }
259
260 > factory := queues.NewExecutableFactory( outbound_queue_factory.go
261 > executor,
262 > scheduler,
263 > rescheduler,
264 > queues.NewNoopPriorityAssigner(),
265 > shardContext.GetTimeSource(),
266 > shardContext.GetNamespaceRegistry(),
267 > shardContext.GetClusterMetadata(),
268 > f.ChasmRegistry,
269 > queues.GetTaskTypeTagValue,
270 > logger,
271 > metricsHandler,
272 > f.TracerProvider.Tracer(telemetry.ComponentQueueOutbound),
273 > f.DLQWriter,
274 > f.Config.TaskDLQEnabled,
275 > f.Config.TaskDLQUnexpectedErrorAttempts,
276 > f.Config.TaskDLQInternalErrors,
277 > f.Config.TaskDLQErrorPattern,
278 > )
279 > return queues.NewImmediateQueue(
280 > shardContext,
281 > tasks.CategoryOutbound,
282 > scheduler,
283 > rescheduler,
284 > &queues.Options{
285 > ReaderOptions: queues.ReaderOptions{
286 > BatchSize: f.Config.OutboundTaskBatchSize,
287 > MaxPendingTasksCount: f.Config.OutboundQueuePendingTaskMaxCount,
288 > PollBackoffInterval: f.Config.OutboundProcessorPollBackoffInterval,
289 > MaxPredicateSize: f.Config.OutboundQueueMaxPredicateSize,
290 > },
291 > MonitorOptions: queues.MonitorOptions{
292 > PendingTasksCriticalCount: f.Config.OutboundQueuePendingTaskCriticalCount,
293 > // Shared configuration with other queues.
294 > ReaderStuckCriticalAttempts: f.Config.QueueReaderStuckCriticalAttempts,
295 > SliceCountCriticalThreshold: f.Config.QueueCriticalSlicesCount,
296 > },
297 > MaxPollRPS: f.Config.OutboundProcessorMaxPollRPS,
298 > MaxPollInterval: f.Config.OutboundProcessorMaxPollInterval,
299 > MaxPollIntervalJitterCoefficient: f.Config.OutboundProcessorMaxPollIntervalJitterCoefficient,
300 > CheckpointInterval: f.Config.OutboundProcessorUpdateAckInterval,
301 > CheckpointIntervalJitterCoefficient: f.Config.OutboundProcessorUpdateAckIntervalJitterCoefficient,
302 > MaxReaderCount: f.Config.OutboundQueueMaxReaderCount,
303 > MoveGroupTaskCountBase: f.Config.QueueMoveGroupTaskCountBase,
304 > MoveGroupTaskCountMultiplier: f.Config.QueueMoveGroupTaskCountMultiplier,
305 > ShrinkPredicateMaxPendingKeys: f.Config.QueueShrinkPredicateMaxPendingKeys,
306 > },
307 > f.hostReaderRateLimiter,
308 > queues.GrouperStateMachineNamespaceIDAndDestination{},
309 > logger,
310 > metricsHandler,
311 > factory,
312 > outboundTaskGroupPostProcessor(f.ChasmRegistry),
313 > )
314 }
315
364 }
365
366 > func outboundTaskGroupPostProcessor(registry *chasm.Registry) func([]tasks.Task) { outbound_queue_factory.go
367 > if registry == nil {
368 return nil
369 }
370 > return func(taskSlice []tasks.Task) { outbound_queue_factory.go
371 > for _, t := range taskSlice {
372 if ct, ok := t.(*tasks.ChasmTask); ok {
373 if rt, ok := registry.TaskByID(ct.Info.GetTypeId()); ok {
go.temporal.io/server/service/history/queues/queue_immediate.go 36 introduced LOC · 11 ranges

Open complete file

61 }
62
63 > if taskPostProcessor != nil { queue_immediate.go
64 > taskPostProcessor(resp.Tasks)
65 > }
66
67 > return resp.Tasks, resp.NextPageToken, nil queue_immediate.go
68 }
69 }
89 }
90
91 > func (p *immediateQueue) Start() { queue_immediate.go
92 > if !atomic.CompareAndSwapInt32(&p.status, common.DaemonStatusInitialized, common.DaemonStatusStarted) {
93 return
94 }
95
96 > p.logger.Info("", tag.LifeCycleStarting) queue_immediate.go
97 > defer p.logger.Info("", tag.LifeCycleStarted)
98 >
99 > p.queueBase.Start()
100 >
101 > p.shutdownWG.Add(1)
102 > go p.processEventLoop()
103 >
104 > p.notify()
105 }
106
122 }
123
124 > func (p *immediateQueue) NotifyNewTasks(tasks []tasks.Task) { queue_immediate.go
125 > if len(tasks) == 0 {
126 return
127 }
128
129 > p.notify() queue_immediate.go
130 }
131
132 > func (p *immediateQueue) processEventLoop() { queue_immediate.go
133 > defer p.shutdownWG.Done()
134 >
135 > pollTimer := time.NewTimer(backoff.Jitter(
136 > p.options.MaxPollInterval(),
137 > p.options.MaxPollIntervalJitterCoefficient(),
138 > ))
139 > defer pollTimer.Stop()
140 >
141 > for {
142 > select {
143 case <-p.shutdownCh:
144 return
145 > default: queue_immediate.go
146 }
147
148 > select { queue_immediate.go
149 case <-p.shutdownCh:
150 return
151 > case <-p.notifyCh: queue_immediate.go
152 > p.processNewRange()
153 case <-pollTimer.C:
154 p.processPollTimer(pollTimer)
169 }
170
171 > func (p *immediateQueue) notify() { queue_immediate.go
172 > select {
173 > case p.notifyCh <- struct{}{}:
174 default:
175 }
go.temporal.io/server/service/history/queues/queue_base.go 4 introduced LOC · 1 range

Open complete file

285 }
286
287 > if now := p.timeSource.Now(); now.After(p.nextForceNewSliceTime) { queue_base.go
288 > reader.AppendSlices(slices...)
289 > p.nextForceNewSliceTime = now.Add(forceNewSliceDuration)
290 > } else {
291 reader.MergeSlices(slices...)
292 }
go.temporal.io/server/common/tasks/group_by_scheduler.go 3 introduced LOC · 1 range

Open complete file

41 }
42
43 > func (*GroupByScheduler[K, T]) Start() { group_by_scheduler.go
44 > // noop
45 > }
46
47 // Stop signals running tasks to stop, aborts any pending tasks and waits up to a minute for all running tasks to
go.temporal.io/server/service/history/queues/scheduler.go 3 introduced LOC · 1 range

Open complete file

230 }
231
232 > func (s *CommonSchedulerWrapper) TaskChannelKeyFn() TaskChannelKeyFn { scheduler.go
233 > return s.TaskKeyFn
234 > }
235
236 func NewRateLimitedScheduler(
go.temporal.io/server/service/history/queues/reader.go 2 introduced LOC · 1 range

Open complete file

563 ) {
564 if len(slices) <= 1 {
565 > return reader.go
566 > }
567
568 for idx, slice := range slices[:len(slices)-1] {