Firebase Cloud Functions Change Timeout

Ameer Taweel :

I'm using Firebase Cloud Functions library on Android, and using getHttpsCallable to call a cloud function.

The problem is that the function needs 10-15 seconds to return the result back to the client, so the client throws an exception java.net.SocketTimeoutException: timeout.

Code

    // Create the arguments to the callable function.
    Map<String, Object> data = new HashMap<>();
    data.put("info", info);
    mFunctions.getHttpsCallable(function)
            .call(data)
            .continueWith(new Continuation<HttpsCallableResult, String>() {
                @Override
                public String then(@NonNull Task<HttpsCallableResult> task) {
                    // This continuation runs on either success or failure, but if the task
                    // has failed then getResult() will throw an Exception which will be
                    // propagated down.
                    if (task.isSuccessful()) {
                        String result = (String) task.getResult().getData();
                        Log.v(Constants.LOG_TAG, result);
                        return result;
                    } else {
                        // The condition never was true, always logs the exception.
                        Exception e = task.getException();
                        Log.e(Constants.LOG_TAG, "Failed to join multiplayer room.", e);
                        return null;
                    }
                }
            });

How can I change the timeout so the client would wait more before throwing the exception?

Note. I'm not using OkHttp, Retrofit or the default system Networking functions, I'm using Firebase Cloud Functions library (getHttpsCallable) to call the function.

Bob Snyder :

firebase-functions version 16.3.0, released 15 Mar 2019, adds the ability to configure the timeout.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=440462&siteId=1