diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-05-02 16:43:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-02 16:43:04 +0100 |
commit | 5a0be97ab2cff42ab338b7d2c801193123e0f934 (patch) | |
tree | a1b63976a208f79357b8abf72cba598e7ea64a69 | |
parent | Merge pull request #3172 from matrix-org/rav/fix_test_logcontext_leaks (diff) | |
parent | Fix logcontext leak in media repo (diff) | |
download | synapse-5a0be97ab2cff42ab338b7d2c801193123e0f934.tar.xz |
Merge pull request #3174 from matrix-org/rav/media_repo_logcontext_leaks
Fix logcontext leak in media repo
-rw-r--r-- | synapse/rest/media/v1/_base.py | 1 | ||||
-rw-r--r-- | synapse/rest/media/v1/media_storage.py | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/synapse/rest/media/v1/_base.py b/synapse/rest/media/v1/_base.py index d9c4af9389..c0d2f06855 100644 --- a/synapse/rest/media/v1/_base.py +++ b/synapse/rest/media/v1/_base.py @@ -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) diff --git a/synapse/rest/media/v1/media_storage.py b/synapse/rest/media/v1/media_storage.py index 7f263db239..d23fe10b07 100644 --- a/synapse/rest/media/v1/media_storage.py +++ b/synapse/rest/media/v1/media_storage.py @@ -255,7 +255,9 @@ class FileResponder(Responder): 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() |