Comments (2)
I needed them to make this async-all-the-way as far as I could tell. I am not a C# developer by trade and built this to help the dev team interface with Consul when I worked at PlayFab, so I think I missed something when referred to the two articles below when I was trying to make some of the methods sync and some async:
http://blog.stephencleary.com/2012/02/async-and-await.html
https://msdn.microsoft.com/en-us/magazine/jj991977.aspx
Given that the code below seems to compile and the tests pass, I'm guessing that I was reading the Task rules wrong and I could return the Task that Execute returns unless I need to transform the result (e.g. KV.Get(string key, QueryOptions q, CancellationToken ct)
re-maps an array member to a single object). Good catch, and a wonderful example of cargo cult coding that resulted in a lot of extra work on my part. I'll fix it up. 😄
public Task<WriteResult<bool>> DeleteCAS(KVPair p)
{
return DeleteCAS(p, WriteOptions.Default);
}
public Task<WriteResult<bool>> DeleteCAS(KVPair p, WriteOptions q)
{
p.Validate();
var req = _client.Delete<bool>(string.Format("/v1/kv/{0}", p.Key), q);
req.Params.Add("cas", p.ModifyIndex.ToString());
return req.Execute();
}
So, to answer your questions:
What do I miss? Is there a meaning behind the awaits? (Just before returning the tasks).
Good catch, that's a bug and I'll fix it.
This tool seem cool and I want to help, do you have any thoughts about the future?
There really isn't a future to it other than "keep it up to date with the Consul Go API." I am explicitly keeping it very low-level - my view is if you want to build a tool that uses it, great, but I don't see this project as a way to add a ton of additional functionality to this API (e.g. remote execution via consul without shelling out to consul exec
was something I attempted and abandoned as out of scope.)
I'd say there are two different things that would help:
- Go over the codebase in code-review fashion and file bugs on stuff you find that's weird, non-idiomatic, inefficient, or otherwise wrong. Optionally, make PRs to fix them. This is probably the most helpful and easiest thing to do.
- There are quite a few commits to the Consul Go API history that I haven't had time to add - I think everything after and including
95c708f65e69562b1aa22e78d130a532c7f3f85c
(Adds Docker checks support to client API.) is missing from the C# API, and if you wanted add functionality like the lock retry capability and porting the related tests, that would be great, though you also have to know Go and be able to translate the two languages' idioms in your head.
from consuldotnet.
Great I'll look up the Consul Go history. and when I have a little bit more time I'll dive into the code and see if there good stuff that can be great! :)
from consuldotnet.
Related Issues (20)
- Consul.ConsulRequestException: Unexpected response, status code InternalServerError: rpc error making call: EOF HOT 4
- No way to read ServiceMeta
- ConsulConfigurationException throw if URL scheme specified in CONSUL_HTTP_ADDR environment variable. HOT 1
- Latest version is not available in Nuget HOT 2
- Add Meta dictionary to AgentService and AgentServiceRegistration HOT 1
- Does not work on netcoreapp2.1 HOT 5
- Enable HttpClientHandler pooling? HOT 2
- KV Txn call may deadlock HOT 3
- Grpc heartbeat HOT 2
- Support for Consul Connect? HOT 1
- 0.9 Port Status
- No .Net Framework 4.0 compatibility HOT 1
- Filter Service and Health by multi tags
- I hope to support the heartbeat of grpc
- Agent.ServiceRegister hangs after KV.Get with new QueryOptions {WaitIndex = index}
- Aquire Lock custom KV value
- Service status
- Bad request : Invalid wait time and multiple Get request while trying to acquire leader HOT 2
- Cluster support
- Add consul.dll.xml into the NuGet package
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 consuldotnet.