Refactor the workflow preview generation to work as a background task API service. Solves GitLab issue #532. The image generation runs as an out of process task ensuring that the HTTP request is never compromised. A new task queue named "document_states_fast" was created. The settings WORKFLOWS_IMAGE_CACHE_TIME, WORKFLOWS_IMAGE_CACHE_STORAGE_BACKEND, WORKFLOWS_IMAGE_CACHE_STORAGE_BACKEND_ARGUMENTS we added. Images generated are stored by default under /mayan/media/workflows. The Dockerfile and deployment instructions are updated to include the new queue. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
from __future__ import unicode_literals
|
|
|
|
import os
|
|
|
|
from django.conf import settings
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from smart_settings import Namespace
|
|
|
|
namespace = Namespace(name='document_states', label=_('Workflows'))
|
|
|
|
settings_workflow_image_cache_time = namespace.add_setting(
|
|
global_name='WORKFLOWS_IMAGE_CACHE_TIME', default='31556926',
|
|
help_text=_(
|
|
'Time in seconds that the browser should cache the supplied workflow '
|
|
'images. The default of 31559626 seconds corresponde to 1 year.'
|
|
)
|
|
)
|
|
setting_workflowimagecache_storage = namespace.add_setting(
|
|
global_name='WORKFLOWS_IMAGE_CACHE_STORAGE_BACKEND',
|
|
default='django.core.files.storage.FileSystemStorage', help_text=_(
|
|
'Path to the Storage subclass to use when storing the cached '
|
|
'workflow image files.'
|
|
)
|
|
)
|
|
setting_workflowimagecache_storage_arguments = namespace.add_setting(
|
|
global_name='WORKFLOWS_IMAGE_CACHE_STORAGE_BACKEND_ARGUMENTS',
|
|
default={'location': os.path.join(settings.MEDIA_ROOT, 'workflows')},
|
|
help_text=_(
|
|
'Arguments to pass to the WORKFLOWS_IMAGE_CACHE_STORAGE_BACKEND.'
|
|
)
|
|
)
|