Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public void testTimeout() {

HttpsCallableReference function =
functions.getHttpsCallable("timeoutTest").withTimeout(10, TimeUnit.MILLISECONDS);
assertEquals(10, function.getTimeout());
Task<HttpsCallableResult> result = function.call();
ExecutionException exe = assertThrows(ExecutionException.class, () -> Tasks.await(result));
Throwable cause = exe.getCause();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ void setTimeout(long timeout, TimeUnit units) {
this.timeoutUnits = units;
}

/**
* Returns the timeout for calls from this instance of Functions.
*
* @return The timeout, in milliseconds.
*/
public long getTimeout() {
return timeoutUnits.toMillis(timeout);
}

/** Creates a new OkHttpClient with these options applied to it. */
OkHttpClient apply(OkHttpClient client) {
return client.newBuilder().callTimeout(timeout, timeoutUnits).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ public void setTimeout(long timeout, @NonNull TimeUnit units) {
}

@NonNull
/**
* Returns the timeout for calls from this instance of Functions.
*
* @return The timeout, in milliseconds.
*/
public long getTimeout() {
return options.getTimeout();
}

/**
* Creates a new reference with the given timeout for calls. The default is 60 seconds.
*
Expand Down