Skip to content

Commit

Permalink
feat(MetadataSyncJob): override API.default_request_timeout if $SDEXT…
Browse files Browse the repository at this point in the history
…ENDEDTIMEOUT is set
  • Loading branch information
cfm authored and gonzalo-bulnes committed Sep 7, 2022
1 parent 715d7ab commit 0679ae4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion securedrop_client/api_jobs/sync.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import os
from typing import Any, List, Optional

from sdclientapi import API
Expand Down Expand Up @@ -41,7 +42,15 @@ def call_api(self, api_client: API, session: Session) -> Any:
#
# This timeout is used for 3 different requests: `get_sources`, `get_all_submissions`, and
# `get_all_replies`
api_client.default_request_timeout = self.DEFAULT_REQUEST_TIMEOUT
api_client.default_request_timeout = int(
os.environ.get("SDEXTENDEDTIMEOUT", self.DEFAULT_REQUEST_TIMEOUT)
)
if api_client.default_request_timeout != self.DEFAULT_REQUEST_TIMEOUT:
logger.warn(
f"{self.__class__.__name__} will use "
f"default_request_timeout={api_client.default_request_timeout}"
)

users = api_client.get_users()
MetadataSyncJob._update_users(session, users)
sources, submissions, replies = get_remote_data(api_client)
Expand Down

0 comments on commit 0679ae4

Please sign in to comment.