From 3a45fc9df6baeb0473fa39f123f05614a4c6c8bc Mon Sep 17 00:00:00 2001 From: Chris Pappas Date: Wed, 18 Dec 2024 16:05:57 -0500 Subject: [PATCH 1/3] fix: add more forgiving timeout duration for sdn backup --- .../commands/populate_sdn_fallback_data_and_metadata.py | 2 +- sanctions/settings/base.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sanctions/apps/sanctions/management/commands/populate_sdn_fallback_data_and_metadata.py b/sanctions/apps/sanctions/management/commands/populate_sdn_fallback_data_and_metadata.py index ecb06bd..8a80eab 100644 --- a/sanctions/apps/sanctions/management/commands/populate_sdn_fallback_data_and_metadata.py +++ b/sanctions/apps/sanctions/management/commands/populate_sdn_fallback_data_and_metadata.py @@ -53,7 +53,7 @@ def handle(self, *args, **options): # download the CSV locally, to check size and pass along to import threshold = options['threshold'] url = settings.CONSOLIDATED_SCREENING_LIST_URL - timeout = settings.SDN_CHECK_REQUEST_TIMEOUT + timeout = settings.SDN_BACKUP_REQUEST_TIMEOUT with requests.Session() as s: try: diff --git a/sanctions/settings/base.py b/sanctions/settings/base.py index 01e857e..48cbc37 100644 --- a/sanctions/settings/base.py +++ b/sanctions/settings/base.py @@ -97,6 +97,7 @@ def root(*path_fragments): # SDN Check SDN_CHECK_REQUEST_TIMEOUT = 5 # Value is in seconds. +SDN_BACKUP_REQUEST_TIMEOUT = 15 # Value is in seconds. # Settings to download the government CSL CONSOLIDATED_SCREENING_LIST_URL = 'https://data.trade.gov/downloadable_consolidated_screening_list/v1/consolidated.csv' # Settings to check government purchase restriction lists From e123d810ac6d3421959ab191a34f99cfd420d938 Mon Sep 17 00:00:00 2001 From: Chris Pappas Date: Wed, 18 Dec 2024 16:13:10 -0500 Subject: [PATCH 2/3] fix: test --- .../management/commands/tests/test_download_sdn_fallback.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sanctions/apps/sanctions/management/commands/tests/test_download_sdn_fallback.py b/sanctions/apps/sanctions/management/commands/tests/test_download_sdn_fallback.py index 6509f50..472446d 100644 --- a/sanctions/apps/sanctions/management/commands/tests/test_download_sdn_fallback.py +++ b/sanctions/apps/sanctions/management/commands/tests/test_download_sdn_fallback.py @@ -151,7 +151,7 @@ def test_timeout_exception(self): self.LOGGER_NAME, 'WARNING', "Sanctions SDNFallback: DOWNLOAD FAILURE: Timeout occurred trying to download SDN CSV. " - "Timeout threshold (in seconds): 5" + "Timeout threshold (in seconds): 15" ) ) From 8987995d0dc01ffe6d4ea4191c6f50893c5210d3 Mon Sep 17 00:00:00 2001 From: Chris Pappas Date: Wed, 18 Dec 2024 16:19:10 -0500 Subject: [PATCH 3/3] chore: quality --- sanctions/settings/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sanctions/settings/base.py b/sanctions/settings/base.py index 48cbc37..d94b2db 100644 --- a/sanctions/settings/base.py +++ b/sanctions/settings/base.py @@ -97,7 +97,7 @@ def root(*path_fragments): # SDN Check SDN_CHECK_REQUEST_TIMEOUT = 5 # Value is in seconds. -SDN_BACKUP_REQUEST_TIMEOUT = 15 # Value is in seconds. +SDN_BACKUP_REQUEST_TIMEOUT = 15 # Value is in seconds. # Settings to download the government CSL CONSOLIDATED_SCREENING_LIST_URL = 'https://data.trade.gov/downloadable_consolidated_screening_list/v1/consolidated.csv' # Settings to check government purchase restriction lists