forked from CGM_Public/pretix_original
Use file.chunks() on large cached files
This commit is contained in:
9
src/pretix/helpers/http.py
Normal file
9
src/pretix/helpers/http.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from django.http import StreamingHttpResponse
|
||||
|
||||
|
||||
class ChunkBasedFileResponse(StreamingHttpResponse):
|
||||
block_size = 4096
|
||||
|
||||
def __init__(self, streaming_content=(), *args, **kwargs):
|
||||
streaming_content = streaming_content.chunks(self.block_size)
|
||||
super().__init__(streaming_content, *args, **kwargs)
|
||||
Reference in New Issue
Block a user