Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Fix FastAPI People GitHub Action: set HTTPX timeout for GraphQL query request #5222

Merged
merged 20 commits into from Sep 4, 2022
Merged
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/actions/people/app/main.py
Expand Up @@ -260,19 +260,22 @@ class Settings(BaseSettings):
input_token: SecretStr
input_standard_token: SecretStr
github_repository: str
http_read_time_out: int = 30


def get_graphql_response(
*, settings: Settings, query: str, after: Union[str, None] = None
):
headers = {"Authorization": f"token {settings.input_token.get_secret_value()}"}
variables = {"after": after}
httpx_time_out = httpx.Timeout(read=settings.http_read_time_out)
response = httpx.post(
github_graphql_url,
headers=headers,
timeout=httpx_time_out,
json={"query": query, "variables": variables, "operationName": "Q"},
)
if not response.status_code == 200:
if response.status_code != 200:
logging.error(f"Response was not 200, after: {after}")
logging.error(response.text)
raise RuntimeError(response.text)
Expand Down