Conversation
|
I'm a little against this because it suites a specific use case and prevents a potentially wanted exception from bubbling up. My general option is that yea runtime exceptions suck but at the same time if you know your future can throw an exception you should by wrapping it with a The role of |
|
Hi @softprops, Yeah, I hear you. I don't necessarily disagree with anything you said, other than that I don't believe that this change will necessarily prevent a wanted exception from bubbling up. It just bubbles up the exception on the Nth attempt instead of the first. That should be totally safe unless you are doing something crazy side-effecty. The way I always saw it, Also, I wish I understood the design intention of Anyway, just my 2 cents :) Joe |
|
I'll have a closer look this weekend. I may have missed something. |
|
So I'm just now finding myself running into this issue and I think what you added makes good sense. I already have another branch that I've been working on with more cohesive abstractions which this will probably conflict with. I'll try to merge this in and fix conflicts on my end. Thanks again for putting effort into this. |
|
Great to hear! This I run into this issue quite a bit, so this will help me a lot. Looking forward to the next release. |
I often get bitten by the fact that the retry logic will not retry if an exception gets thrown within the body of the future. The workaround I have been using in the past is to have the future wrap a
scala.util.Try. Doing so works, but is unnecessary sinceTryis already incorporated intoscala.concurrent.Future(seeFuture.onComplete, for instance). So having to deal with aFuture[Try[T]]is a little redundant and unnecessarily cumbersome.As a solution, I added a simple
recoverWithblock that will perform a retry (and decrement the max retries) if the future fails. I also added a unit test