-
Notifications
You must be signed in to change notification settings - Fork 10
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
Timeout don't work while using SyncCommand #54
Comments
Could you describe a bit more about what's not working with it? Is your Command a network call? If you could share a code snippet (maybe your Command's execute method contents), that'd be helpful. The timeout should work for any network calls within the Command's execute method, provided that you use the passed-in Mjolnir currently doesn't do any thread aborts (i.e. it won't hard-kill a thread or operation unless that operation's also looking at the This page might help shed some insight if you haven't run across it already. |
It's a wcf service calling, so there is no CancellationToken parameter to pass into.
` Inside the GetUser Service, i make a Thread.Sleep(3000) there, but although i set the timeout with 1 second, the excute method don't fail fast |
It's unfortunate that the service method there doesn't have a All of our cancellation/timeouts are cooperative, so we've never had a strong need to address the case where an API/library doesn't support timeouts. Is |
UserServiceClient is a subclass of ClientBase, which is generated by svcutil.exe of visual studio. Do you mean that i can wrap my GetUser calling in another method, like this:
|
I'd be wary of doing that - it might "work", but you're still going to have the You might find these useful for some more context: |
Thank you for your suggestion. But the UserServiceClient.GetUser is a RPC calling, it's a remoting service in another system, i can't control it |
Any sort of network I/O API that doesn't allow for passing or configuring a timeout is putting you in kind of a tight spot, unfortunately. What kind of service call is it? Is it WCF? |
Yes, it's wcf, and i know wcf support timeout itself. But in my system, there is other services that don't support timeout, and this is the important reason why i want to find a component like hystrix |
Gotcha. Unfortunately, killing threads/operations isn't something that Mjolnir supports at the moment. It's a possibility down the road, and I'd be happy to help advise on a PR if you'd be interested in contributing! |
Hi,
Netflix's Hystrix component is very useful, so i'm looking for the same component in C#, and i search the google and find your project. But it seems the timeout future don't work though i've pass it to the syncCommand's constructor. This is the very import future i think, please let me know is it the Mjolnir can't do it with sync invoke, or i use it in a wrong way?
The text was updated successfully, but these errors were encountered: