-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How would I retry a failed method? #25
Comments
With DynamicProxy ONLY it doesn't work, because the methods in the service are async-based (they return |
@SuperJMN I asked if it works for synchronous calls. I'm trying to understand if this is a constraint of DynamicProxy or this library. Though as I said, I don't use DynamicProxy, therefore it's not a scenario with which I'm familiar. In that regard maybe you're better off trying stack overflow instead. |
Oh, OK. I'm not completely sure if it work to retry sync calls. But I think they should work. Also, I don't know if the problem is with your library, but it's possible that the reason why the retry doesn't work is that the async method is called once, and it the task it receives is faulted, then, the faulted task is returned in each iteration. In other words, it doesn't actually retry the operation, it just returns the same faulted tasks and the loop is repeated forever. Could you please check the code? for example, make a sample class with a method with the following behaviors Using your AsyncInterceptor and the do-loop I put, it should loop forever. Thanks for your patience! |
@SuperJMN I'm afraid I don't have the time to perform an investigation at the moment. I may have a look at a later date, but I'm afraid I cannot commit to investigating this anytime soon. Can you try it? There are extensive tests, you could try it out as a test. If you find an issue, and you submit a PR with a failing test, then I could pick it it from there if you're unable to find a fix yourself. PRs are always welcome :-) |
@SuperJMN If you're blocked by this, you can use the following work around class. However, this uses Reflection and relies on internal details of Castle.Core, so I would not recommend it for production code or as a true fix. It works with Castle.Core v4.2.0 net46. I'll continue looking into more proper solutions to the problem. Primary caveats:
|
I'm calling a remote service that is rate-limited. If you invoke a method lots of times, it ends up throwing a Exception. I would like to be able to retry a call until it finished successfully. The current code I have is this (notice that I only added a do-loop around your original code :)
Thanks in advance!
The text was updated successfully, but these errors were encountered: