From 6df99ead7b017f7f19478fae9202b142f1a75be3 Mon Sep 17 00:00:00 2001 From: ThrawnCA Date: Mon, 7 Aug 2023 09:28:25 +1000 Subject: [PATCH 1/2] [QOLDEV-490] fix timeout extension - Can't multiply a string by 3, we get repeated text instead of arithmetic multiplication --- ckanext/xloader/action.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ckanext/xloader/action.py b/ckanext/xloader/action.py index f52d8d77..e45394a9 100644 --- a/ckanext/xloader/action.py +++ b/ckanext/xloader/action.py @@ -152,10 +152,11 @@ def xloader_submit(context, data_dict): 'original_url': resource_dict.get('url'), } } - timeout = config.get('ckanext.xloader.job_timeout', '3600') - if not utils.datastore_resource_exists(res_id): - # Expand timeout for resources that have to be type-guessed - timeout = timeout * 3 + # Expand timeout for resources that have to be type-guessed + timeout = config.get( + 'ckanext.xloader.job_timeout', + '3600' if utils.datastore_resource_exists(res_id) else '10800') + log.debug("Timeout for XLoading resource %s is %s", res_id, timeout) try: job = enqueue_job( From 388bc7b70c7bd733380fc73fe4b74d384bb7b114 Mon Sep 17 00:00:00 2001 From: ThrawnCA Date: Mon, 7 Aug 2023 09:50:30 +1000 Subject: [PATCH 2/2] [QOLDEV-490] fix load method logic - Missed a 'not' when checking if datastore exists --- ckanext/xloader/jobs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckanext/xloader/jobs.py b/ckanext/xloader/jobs.py index 7819c96e..9fae67c2 100644 --- a/ckanext/xloader/jobs.py +++ b/ckanext/xloader/jobs.py @@ -211,7 +211,7 @@ def tabulator_load(): use_type_guessing = asbool( config.get('ckanext.xloader.use_type_guessing', config.get( 'ckanext.xloader.just_load_with_messytables', False))) \ - and datastore_resource_exists(resource['id']) \ + and not datastore_resource_exists(resource['id']) \ and os.path.getsize(tmp_file.name) <= MAX_TYPE_GUESSING_LENGTH logger.info("'use_type_guessing' mode is: %s", use_type_guessing) try: