When you configure Google Cloud Functions, you can set the Timeout property of the function. This property specifies the amount of time that the function will keep running if you do not complete the function. The default timeout is set to 60 seconds.
While this might look ok, keep in mind that when it comes to Cloud Functions pricing, one key factor you are charged for is the amount of time that the functions are running. So you want to keep this to a minimum and not let it timeout.
As a best practice, you should use the appropriate mechanism to complete the function as soon as possible and this depends on Function type.
- HTTP Functions: Invoke the the
send()
,resend()
or theend()
methods on the Express JS response once you are done with the functionality.