Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Tempo limite da função (1ª geração)
Se uma função for executada por muito tempo, o sistema tomará medidas para encerrar ou limitar essa função. Por padrão, esse tempo limite é de 60 segundo, mas é possível ampliar ou reduzir ao implantar a função: A duração máxima do tempo limite é de nove
minutos (540 segundos).
Quando a execução da função atinge o tempo limite, uma mensagem de resposta com um status de erro
HTTP, geralmente 408, é retornada imediatamente ao autor da chamada. A execução
da função é interrompida.
Definir a duração do tempo limite
É possível definir a duração do tempo limite de uma função na implantação usando a Google Cloud CLI ou o console do Google Cloud.
gcloud
Se a implantação usar a CLI gcloud, use a sinalização --timeout:
Expanda a seção Ambiente de execução, build... no final da página e clique na guia Ambiente de execução.
No campo Tempo limite, digite um número de segundos.
Para editar um tempo limite atual no Console do Google Cloud, na página de informações gerais das funções, clique no nome da função para acessar a página de detalhes. Na página de detalhes, clique em Editar, expanda a seção Ambiente de execução, versão...
e clique na guia Ambiente de execução, em que é possível editar diretamente o valor no campo Timeout.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-01-31 UTC."],[[["\u003cp\u003eFunctions have a default timeout of 60 seconds, which can be adjusted during deployment.\u003c/p\u003e\n"],["\u003cp\u003eThe maximum timeout duration for a function is nine minutes (540 seconds).\u003c/p\u003e\n"],["\u003cp\u003eWhen a function exceeds its timeout, an HTTP error (typically 408) is returned, and execution stops.\u003c/p\u003e\n"],["\u003cp\u003eTimeout duration can be set or modified during deployment or through redeployment, using either the Google Cloud CLI or the Google Cloud console.\u003c/p\u003e\n"]]],[],null,["# Function timeout (1st gen)\n==========================\n\nIf a function runs for too long, the system takes steps to terminate or\nthrottle it. This timeout period defaults to 60 seconds, but you can extend or\nreduce it when you deploy the function. The maximum timeout duration is nine\nminutes (540 seconds).\n\nWhen function execution reaches its timeout, a response message with an HTTP\nerror status, generally 408, is immediately returned to the caller; function\nexecution is halted.\n\nSet a timeout duration\n----------------------\n\nYou can set a function's timeout duration at deployment using the\nGoogle Cloud CLI or the Google Cloud console. \n\n### gcloud\n\nIf you are deploying using the gcloud CLI, use the\n[`--timeout`](/sdk/gcloud/reference/functions/deploy#--timeout) flag: \n\n```sh\ngcloud functions deploy YOUR_FUNCTION_NAME --no-gen2 --timeout=TIMEOUT_DURATION ...\n```\n\nTo edit an existing timeout duration with Google Cloud CLI, redeploy the\nfunction with a new timeout value.\n\n### Console\n\nTo set the timeout duration during function creation in the\nGoogle Cloud console:\n\n1. Go to the [Cloud Run functions Overview page](https://console.cloud.google.com/functions/list) in the Google Cloud console.\n2. Click **Create function**.\n3. Fill in the required fields for your function.\n4. Expand the **Runtime, build...** section at the end of the page and click the **Runtime** tab.\n5. In the **Timeout** field, enter a number of seconds.\n\n To edit an existing timeout duration in Google Cloud console, on the functions\n overview page click the name of the function to go to its details\n page. On the details page click **Edit** , expand the **Runtime, build...**\n section, and click the **Runtime** tab, where you can directly edit the\n value in the **Timeout** field."]]