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

How to set timeout of objective rpc request? #4585

Closed
0x5143 opened this issue Dec 30, 2015 · 11 comments
Closed

How to set timeout of objective rpc request? #4585

0x5143 opened this issue Dec 30, 2015 · 11 comments

Comments

@0x5143
Copy link

0x5143 commented Dec 30, 2015

I need to set timeout of each request, how can i do this in objective-c?

@wkubiak
Copy link
Contributor

wkubiak commented Jan 21, 2016

I'm also curious as to how to best handle timeouts on the iOS port. By default it seems that it's indefinite and no error is sprung.

Or maybe should it be tackled from the other side, ie. the server?

@jcanizales
Copy link
Contributor

Hi guys, sorry for the delay replying!

There's an unimplemented feature request (#2114) for setting timeouts easily. Until it's implemented, it has to be done "the hard way", i.e., start a timeout yourself when starting the call, and have it cancel the request when it triggers. Which is probably a bit of a PITA.

For things like Internet becoming unreachable, I'm working this week on implementing #4064, which will take care of those conditions better than setting timeouts.

As Wojtek says, implementing the timeout in the server is another possibility (and it's probably a good idea anyway, no matter what's done on the client).

@sp71
Copy link

sp71 commented Jan 26, 2016

I am facing the same issue regarding unable to set the timeout. You mentioned we can cancel the GRPC request. How can we do so?

@jcanizales
Copy link
Contributor

You can see an example here: https://github.com/grpc/grpc/blob/master/src/objective-c/tests/InteropTests.m#L269
It uses an RPC object as described here.

@sp71
Copy link

sp71 commented Feb 2, 2016

I tried compiling that project; however, the pod install fails with the following error message:

Installing BoringSSL (2.0)
Installing Protobuf (3.0.0-alpha-4.1)
Installing RemoteTest (0.0.1)
[!] /bin/bash -c
set -e
BINDIR=../../../../bins/$CONFIG
PROTOC=$BINDIR/protobuf/protoc
PLUGIN=$BINDIR/grpc_objective_c_plugin
$PROTOC --plugin=protoc-gen-grpc=$PLUGIN --objc_out=. --grpc_out=. *.proto

/bin/bash: line 5: ../../../../bins//protobuf/protoc: No such file or directory

@wkubiak
Copy link
Contributor

wkubiak commented Feb 3, 2016

@sp71 That example project is a bit old, so the environment vars may have changed since then. If it can't find protoc, check if it's really there where it expects it (the PROTOC environment var in the script). If it's at a different location in your setup, change appropriately.

Ideally, I wouldn't try and compile that example project. I'd just take the code shown which enables using timeouts and place it into your working code.

@jcanizales
Copy link
Contributor

Yeah, that project, specifically, is for testing, and the script to run the tests sets $CONFIG after compiling protoc and the test server from source. Let me create an issue to make its podspec default to whatever is installed on the machine if those variables aren't set.

@makdharma
Copy link
Contributor

We should support setting a deadline or timeout as part of objc API.

@nicolasnoble nicolasnoble modified the milestones: GA, 2016/05/21 Milestone Apr 21, 2016
@jcanizales
Copy link
Contributor

Closing this issue because it's tracked somewhere else.

@pbatg
Copy link
Contributor

pbatg commented May 17, 2017

@jcanizales, did you mean to link to #9555?

@jcanizales
Copy link
Contributor

I think it was #2114 .

@jcanizales jcanizales removed their assignment May 22, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Oct 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants