Hi,
Hope you all are doing well.
I'm writing this question to solve a problem which i'm confronting now using GCP service, cloud function and cloud scheduler.
This is for the service of the company i'm working for.
To make it short, I made a cloud function called as Automatic PR Labeler that iterates specifically-targeted pull requests list of a repository and update "D-day label" by subtracting a day on daily basis.
For example, (D-5) Label will be (D-4) tomorrow.
I have problems when calling cloud function to run from cloud scheduler by using HTTP URL not pubsub. The error shown in log of cloud function is
"Function execution took 540101 ms. Finished with status: timeout".
But it works If I use pubsub to call this cloud function. It works well on every midnight based on Seoul, South Korea time.
However I realized that using pubsub to run this function is not efficient because it's not fit for fundamental purpose. Thus, I want to use HTTP URL to call the cloud function.
I kindly hope someone gives me advices or solutions.
Thanks a lot for reading this question.
Best Regard,
Jay.
Hi @jaykimmy,
Function timeout
Function execution time is limited by the timeout duration, which you can specify when you deploy a function. By default, a function times out after one minute (60 seconds), but you can extend this period:
When function execution exceeds the timeout, an error status is immediately returned to the caller. CPU resources used by the timed-out function instance are throttled and request processing is paused.
In some circumstances, paused work might continue in the background or resume upon a subsequent request, which can cause unexpected side effects. A common symptom of this behavior is the appearance that work and logs from one request are "leaking" into a subsequent request. Because you cannot depend on paused work being resumed, you must not rely on this behavior. Instead, your function should avoid timeouts using a combination of the following techniques:
Set a timeout duration
You can set a function's timeout duration at deployment using the Google Cloud CLI or the Google Cloud console.
If you are deploying using the gcloud CLI, use the --timeout flag:
gcloud functions deploy YOUR_FUNCTION_NAME --timeout=TIMEOUT_DURATION ...
Thank you.