Skip to content

Commit

Permalink
refactor(MetadataSyncJob): define constant DEFAULT_REQUEST_TIMEOUT
Browse files Browse the repository at this point in the history
---so that we have something to compare to when we override it.
  • Loading branch information
cfm committed Aug 30, 2022

Unverified

The key that signed this is expired.
1 parent a2899c7 commit f635ac0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion securedrop_client/api_jobs/sync.py
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ class MetadataSyncJob(ApiJob):
Update source metadata such that new download jobs can be added to the queue.
"""

DEFAULT_REQUEST_TIMEOUT = 60 # sec
NUMBER_OF_TIMES_TO_RETRY_AN_API_CALL = 2

def __init__(self, data_dir: str, app_state: Optional[state.State] = None) -> None:
@@ -40,7 +41,7 @@ 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 = 60
api_client.default_request_timeout = self.DEFAULT_REQUEST_TIMEOUT
users = api_client.get_users()
MetadataSyncJob._update_users(session, users)
sources, submissions, replies = get_remote_data(api_client)

0 comments on commit f635ac0

Please sign in to comment.