Comments (5)
all client fibers waiting for a consumer will get an error.
if there are no other consumers in the pool - all get an error, but attempts after - will initiate allocation of a new consumers.
If maxSize > 1
, only one attempt will fail.
you can implement retry on the level of passed resource, we don't need to encode this into the pool.
if (entries.isEmpty) {
means maxSize=1
from resource-pool.
- Something I don't understand is why do we count in
tailRecM
, for example
0.tailRecM { count =>
...
...
(count + 1).asLeft[Unit].pure[F]
Is this for debugging? I would just do
().tailRecM { _ =>
().asLeft[Unit].pure[F]
}
from resource-pool.
could be useful for debugging, and in short it does not provide more overhead comparing to what you propose :)
also it's nice when type differs from a happy path
from resource-pool.
What happens if we fail to allocate the resource and there are tasks (Deferred
s) in the queue?
if (entries.isEmpty) {
state.stage match {
case stage: State.Allocated.Stage.Free =>
apply(stage) { ().pure[F] }
case stage: State.Allocated.Stage.Busy =>
apply {
State.Allocated.Stage.free(List.empty)
} {
stage
.tasks
.foldMapM { task =>
task
.complete(a.asLeft)
.void
}
}
}
} else {
apply(stage) { ().pure[F] }
}
Looks like we complete all Deferred
s with an error. What if there's just a temporary glitch? For example, when a KafkaConsumer gets created it tries to establish a connection to the broker. If there's a temporary network problem and one allocation fails because of it, all client fibers waiting for a consumer will get an error.
Shouldn't we retry allocation to avoid such situation?
from resource-pool.
Thanks for explanations! I couldn't find any bugs in the code. I've reviewed roughly half of it (I didn't review parts of code related to graceful shutdown).
from resource-pool.
Related Issues (2)
- test Slack integration HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from resource-pool.