Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3174 from matrix-org/rav/media_repo_logcontext_leaks
Browse files Browse the repository at this point in the history
Fix logcontext leak in media repo
  • Loading branch information
richvdh authored May 2, 2018
2 parents 4e9bdeb + be31adb commit 5a0be97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions synapse/rest/media/v1/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def respond_with_responder(request, responder, media_type, file_size, upload_nam
respond_404(request)
return

logger.debug("Responding to media request with responder %s")
add_file_headers(request, media_type, file_size, upload_name)
with responder:
yield responder.write_to_consumer(request)
Expand Down
4 changes: 3 additions & 1 deletion synapse/rest/media/v1/media_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ def __init__(self, open_file):
self.open_file = open_file

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):
self.open_file.close()

0 comments on commit 5a0be97

Please sign in to comment.