Merge pull request #3174 from matrix-org/rav/media_repo_logcontext_leaks
Fix logcontext leak in media repo
This commit is contained in:
commit
5a0be97ab2
|
@ -143,6 +143,7 @@ def respond_with_responder(request, responder, media_type, file_size, upload_nam
|
||||||
respond_404(request)
|
respond_404(request)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
logger.debug("Responding to media request with responder %s")
|
||||||
add_file_headers(request, media_type, file_size, upload_name)
|
add_file_headers(request, media_type, file_size, upload_name)
|
||||||
with responder:
|
with responder:
|
||||||
yield responder.write_to_consumer(request)
|
yield responder.write_to_consumer(request)
|
||||||
|
|
|
@ -255,7 +255,9 @@ class FileResponder(Responder):
|
||||||
self.open_file = open_file
|
self.open_file = open_file
|
||||||
|
|
||||||
def write_to_consumer(self, consumer):
|
def write_to_consumer(self, consumer):
|
||||||
return FileSender().beginFileTransfer(self.open_file, consumer)
|
return make_deferred_yieldable(
|
||||||
|
FileSender().beginFileTransfer(self.open_file, consumer)
|
||||||
|
)
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
self.open_file.close()
|
self.open_file.close()
|
||||||
|
|
Loading…
Reference in New Issue