Repository navigation
Adiciona timeout em todas as chamadas HTTP dos API Clients - #27
Merged
Merged
Conversation
Os clients passam a herdar de BaseApiClient, que aplica 5s de limite para conectar e 30s para a resposta em toda requisição. Sem timeout, o requests pode esperar indefinidamente e deixar o CI parado se a API pública travar.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumo
BaseApiClient(api/base_api_client.py): toda chamada dos clients passa pelo método_request, que monta a URL e aplica o timeout(5, 30): 5 segundos para conectar e 30 para receber a resposta. A margem maior na resposta cobre o tempo que o Heroku pode levar para acordar a aplicação. O valor pode ser trocado por client, pelo construtorAuthApiClienteBookingApiClientpassam a herdar da classe base. As assinaturas e o comportamento dos métodos não mudamrequestsnão tem timeout por padrão. Se a API pública travar sem responder, o job do CI fica parado até o limite de 6 horas do GitHub ActionsTest plan
mypy .ruff check .ruff format --check .pytest: 47/47 testes passando (26 cenários BDD contra a API pública e 21 testes unitários), cobertura deapi/emodels/em 100%tests/unit/test_base_api_client.py: timeout padrão, timeout personalizado e montagem da URL