You can write a producer (using `produce` builder)...
# coroutines
e
You can write a producer (using
produce
builder) that does the load balancing and merges all them into the one request stream. So, the producer takes two channels as parameters (priority and non-priority) and mixes requests using the code of yours. This way, the logic becomes modular. You can now receive from the produced channel using the regular
for
loop.
1