Skip to content

Commit

Permalink
only set default_request_timeout in Controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Allie Crevier committed Dec 3, 2019
1 parent 9845b29 commit 426ae22
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion securedrop_client/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def login(self, username, password, totp):
"""
storage.mark_all_pending_drafts_as_failed(self.session)
self.api = sdclientapi.API(
self.hostname, username, password, totp, self.proxy, default_request_timeout=60)
self.hostname, username, password, totp, self.proxy, default_request_timeout=20)
self.call_api(self.api.authenticate,
self.on_authenticate_success,
self.on_authenticate_failure)
Expand Down
10 changes: 2 additions & 8 deletions securedrop_client/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,12 @@ class ApiJobQueue(QObject):

def __init__(self, api_client: API, session_maker: scoped_session) -> None:
super().__init__(None)
self.api_client = api_client

self.main_thread = QThread()
self.download_file_thread = QThread()

self.main_queue = RunnableQueue(self.api_client, session_maker)
self.download_file_queue = RunnableQueue(self.api_client, session_maker)
self.main_queue = RunnableQueue(api_client, session_maker)
self.download_file_queue = RunnableQueue(api_client, session_maker)

self.main_queue.moveToThread(self.main_thread)
self.download_file_queue.moveToThread(self.download_file_thread)
Expand All @@ -159,11 +158,6 @@ def logout(self) -> None:

def login(self, api_client: API) -> None:
logger.debug('Passing API token to queues')

# Setting realistic (shorter) timeout for general requests so that user feedback
# is faster
api_client.default_request_timeout = 5

self.main_queue.api_client = api_client
self.download_file_queue.api_client = api_client
self.start_queues()
Expand Down

0 comments on commit 426ae22

Please sign in to comment.