MCPcopy Create free account
hub / github.com/ReactiveX/RxGo / runSequential

Function runSequential

observable.go:266–301  ·  view source on GitHub ↗
(ctx context.Context, next chan Item, iterable Iterable, operatorFactory func() operator, option Option, opts ...Option)

Source from the content-addressed store, hash-verified

264}
265
266func runSequential(ctx context.Context, next chan Item, iterable Iterable, operatorFactory func() operator, option Option, opts ...Option) {
267 observe := iterable.Observe(opts...)
268 go func() {
269 op := operatorFactory()
270 stopped := false
271 operator := operatorOptions{
272 stop: func() {
273 if option.getErrorStrategy() == StopOnError {
274 stopped = true
275 }
276 },
277 resetIterable: func(newIterable Iterable) {
278 observe = newIterable.Observe(opts...)
279 },
280 }
281
282 loop:
283 for !stopped {
284 select {
285 case <-ctx.Done():
286 break loop
287 case i, ok := <-observe:
288 if !ok {
289 break loop
290 }
291 if i.Error() {
292 op.err(ctx, i, next, operator)
293 } else {
294 op.next(ctx, i, next, operator)
295 }
296 }
297 }
298 op.end(ctx, next)
299 close(next)
300 }()
301}
302
303func runParallel(ctx context.Context, next chan Item, observe <-chan Item, operatorFactory func() operator, bypassGather bool, option Option, opts ...Option) {
304 wg := sync.WaitGroup{}

Callers 3

observableFunction · 0.85
singleFunction · 0.85
optionalSingleFunction · 0.85

Calls 6

ObserveMethod · 0.65
getErrorStrategyMethod · 0.65
ErrorMethod · 0.65
errMethod · 0.65
nextMethod · 0.65
endMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…