Comments (2)
I think passing in a CancellationToken is only needed if you ever want to cancel the operation from the outside, if you don't want to do that, you can omit the argument.
@JorritSalverda is there any situation when it's needed?
from hystrix.dotnet.
It's to make sure that if the circuit breaker times out before the code it executes does it cancels that code. You use it as follows:
var cancellationTokenSource = new CancellationTokenSource();
var client = new System.Net.Http.HttpClient();
var response = await hystrixCommandFactory.GetHystrixCommand("group", "command").ExecuteAsync(
async () => await client.GetAsync(url, cancellationTokenSource.Token).ConfigureAwait(false)
, cancellationTokenSource).ConfigureAwait(false);
So if your circuit breaker has a 1 second timeout and the HttpClient 30 seconds without it it would continue to run up to 30 seconds, whereas with the cancellationtoken it get's cancelled after 1 second.
from hystrix.dotnet.
Related Issues (14)
- Hystrix.Dotnet.Samples.AspNetCore not working out of the box HOT 1
- Stream metrics from console/windows application HOT 1
- [Questions] HystrixCommand Design Implementation HOT 3
- Owin middleware HOT 3
- Implement retry HOT 2
- Add example for fallback function to README.md HOT 1
- Create online documentation from docstrings HOT 4
- How to open the project HOT 1
- Signed Assembly not available in Nuget
- Execute method does not pass exception as a parameter in Fallback method
- ObjectDisposedException on .NET Core
- Remove depedency to Log4Net HOT 3
- Add HystrixThreadPool to the stream HOT 2
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 hystrix.dotnet.