Cache: Beta stage

Add retry to race condition in intermediate image generation.

Remove DB index from cache file size field.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-12-03 04:26:00 -04:00
parent 77fc9b5831
commit 89d3fb9922
7 changed files with 68 additions and 24 deletions

View File

@@ -38,7 +38,6 @@ from .serializers import (
WritableDocumentTypeSerializer, WritableDocumentVersionSerializer
)
from .settings import settings_document_page_image_cache_time
from .storages import storage_documentimagecache
from .tasks import task_generate_document_page_image
logger = logging.getLogger(__name__)
@@ -234,7 +233,6 @@ class APIDocumentPageImageView(generics.RetrieveAPIView):
)
cache_filename = task.get(timeout=DOCUMENT_IMAGE_TASK_TIMEOUT)
#with storage_documentimagecache.open(cache_filename) as file_object:
with self.get_object().cache_partition.get_file(filename=cache_filename).open() as file_object:
response = HttpResponse(file_object.read(), content_type='image')
if '_hash' in request.GET: