Comments (1)
Hmmm, it actually does retry though. Let's talk it through quick... so here is the code:
public static async Task<T> WithRetry<T>(Func<Task<T>> action, int retryCount = 3)
{
int retries = 0;
while (true)
{
try
{
return await action().ConfigureAwait(false);
}
catch when (++ retries <= retryCount)
{
// Ease up a bit...
await Delay(500).ConfigureAwait(false);
return await TaskCache<T>.Default;
}
}
}
Scenario 1, if the given action
is successful the first invocation to it... we're done, no reason to retry and we exit the while (true)
loop.
Scenario 2, if the given action
throws (imagine a transient error) on the first invocation, we're in a while
loop... the catchwhen
will enter as retries is only incremented to 1
and still less than the default retryCount
of 3
. We then await 500 milliseconds, oh! I see 👀 ... the return await TaskCache<T>.Default
is actually wrong. That should be removed, that is a bug... nice catch.
from mirror.
Related Issues (8)
- Build error dll could not be found HOT 2
- Requesting weather takes too long on slow connection HOT 5
- Could you provide (brief) instructions on the hardware setup you use with this? HOT 3
- How can I add GoogleCalender? HOT 4
- Calendars HOT 6
- TryParseExtensions HOT 2
- The speech privacy policy was not accepted HOT 3
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 mirror.