From f2ac8e48e369a5b08b1fc3ea2c2ba5ba75ca0069 Mon Sep 17 00:00:00 2001 From: Francesco Siddi Date: Thu, 26 Nov 2015 19:20:07 +0100 Subject: [PATCH] Asynchronous push_to_storage for files and images --- pillar/application/modules/file_storage/__init__.py | 4 +++- pillar/application/utils/storage.py | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pillar/application/modules/file_storage/__init__.py b/pillar/application/modules/file_storage/__init__.py index 57899872..bf9e371a 100644 --- a/pillar/application/modules/file_storage/__init__.py +++ b/pillar/application/modules/file_storage/__init__.py @@ -199,7 +199,9 @@ def process_file(src_file): if mime_type != 'video': # Sync the whole subdir sync_path = os.path.split(file_abs_path)[0] - push_to_storage(str(src_file['project']), sync_path) + # push_to_storage(str(src_file['project']), sync_path) + p = Process(target=push_to_storage, args=(str(src_file['project']), sync_path)) + p.start() else: sync_path = file_abs_path diff --git a/pillar/application/utils/storage.py b/pillar/application/utils/storage.py index 123f5286..9328394d 100644 --- a/pillar/application/utils/storage.py +++ b/pillar/application/utils/storage.py @@ -75,7 +75,6 @@ def push_to_storage(project_id, full_path, backend='cgs'): for root, dirs, files in os.walk(full_path): for name in files: push_single_file(project_id, os.path.join(root, name), backend) - else: raise IOError('ERROR: path not found')