Skip to content
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

Setting deadlines/timeouts on individual calls #16

Closed
tav opened this issue Jan 25, 2018 · 4 comments
Closed

Setting deadlines/timeouts on individual calls #16

tav opened this issue Jan 25, 2018 · 4 comments

Comments

@tav
Copy link

tav commented Jan 25, 2018

Would it be possible to add support for setting deadlines on individual calls with the dgraph-js client?

Perhaps the calls could take an optional options parameter? e.g.

await txn.mutate(mu, {deadline: 1516844615385})

As far as I can tell, the Dgraph Go client supports enforcing deadlines on individual calls, and from briefly looking at the Node.js gRPC implementation, it seems to support CallOptions with a deadline property too. So it should hopefully be just a matter of threading it through via the wrapper functions?

@gpahal
Copy link
Contributor

gpahal commented Jan 26, 2018

Yes, this is possible and I think this will be a good addition. I will add an option parameter to individual method calls and also to the DgraphClientStub contructor (https://grpc.io/grpc/node/grpc.Client.html).

@tav
Copy link
Author

tav commented Jan 26, 2018

Thanks @gpahal!

@gpahal
Copy link
Contributor

gpahal commented Jan 29, 2018

I've added the basic functionality in v1.0.4-beta.3. It's available with the next tag:

npm install dgraph-js@next grpc --save

You can pass an additional argument of type grpc.CallOptions to the DgraphClient#alter, Txn#query, Txn#queryWithVars, Txn#mutate, Txn#commit and Txn#discard methods.

@gpahal
Copy link
Contributor

gpahal commented Feb 2, 2018

Done in v1.0.4

@gpahal gpahal closed this as completed Feb 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants