Skip to content

Commit b4b6525

Browse files
authored
Compatibility with changes to the LoggingContext in Synapse (#36)
1 parent 26ff8d8 commit b4b6525

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,6 @@ ENV/
103103
# Temp files
104104
*~
105105
_trial*
106+
107+
# PyCharm project settings
108+
.idea

s3_storage_provider.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@
2626
from twisted.python.failure import Failure
2727
from twisted.python.threadpool import ThreadPool
2828

29+
from synapse.logging.context import LoggingContext, make_deferred_yieldable
2930
from synapse.rest.media.v1._base import Responder
3031
from synapse.rest.media.v1.storage_provider import StorageProvider
31-
from synapse.util.logcontext import LoggingContext, make_deferred_yieldable
32+
33+
# Synapse 1.13.0 moved current_context to a module-level function.
34+
try:
35+
from synapse.logging.context import current_context
36+
except ImportError:
37+
current_context = LoggingContext.current_context
3238

3339
logger = logging.getLogger("synapse.s3")
3440

@@ -93,7 +99,7 @@ def _store_file():
9399

94100
def fetch(self, path, file_info):
95101
"""See StorageProvider.fetch"""
96-
logcontext = LoggingContext.current_context()
102+
logcontext = current_context()
97103

98104
d = defer.Deferred()
99105
self._download_pool.callInThread(

0 commit comments

Comments
 (0)