forked from MirrorHub/synapse
Fix a couple of logcontext leaks
Use preserve_fn to correctly manage the logcontexts around things we don't want to yield on.
This commit is contained in:
parent
35e0cfb54d
commit
19b9366d73
|
@ -23,7 +23,7 @@ from synapse import event_auth
|
||||||
from synapse.api.constants import EventTypes, Membership, JoinRules
|
from synapse.api.constants import EventTypes, Membership, JoinRules
|
||||||
from synapse.api.errors import AuthError, Codes
|
from synapse.api.errors import AuthError, Codes
|
||||||
from synapse.types import UserID
|
from synapse.types import UserID
|
||||||
from synapse.util.logcontext import preserve_context_over_fn
|
from synapse.util import logcontext
|
||||||
from synapse.util.metrics import Measure
|
from synapse.util.metrics import Measure
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -209,8 +209,7 @@ class Auth(object):
|
||||||
default=[""]
|
default=[""]
|
||||||
)[0]
|
)[0]
|
||||||
if user and access_token and ip_addr:
|
if user and access_token and ip_addr:
|
||||||
preserve_context_over_fn(
|
logcontext.preserve_fn(self.store.insert_client_ip)(
|
||||||
self.store.insert_client_ip,
|
|
||||||
user=user,
|
user=user,
|
||||||
access_token=access_token,
|
access_token=access_token,
|
||||||
ip=ip_addr,
|
ip=ip_addr,
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
import synapse.util.logcontext
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from synapse.api.errors import CodeMessageException
|
from synapse.api.errors import CodeMessageException
|
||||||
|
@ -173,4 +173,5 @@ class RetryDestinationLimiter(object):
|
||||||
"Failed to store set_destination_retry_timings",
|
"Failed to store set_destination_retry_timings",
|
||||||
)
|
)
|
||||||
|
|
||||||
store_retry_timings()
|
# we deliberately do this in the background.
|
||||||
|
synapse.util.logcontext.preserve_fn(store_retry_timings)()
|
||||||
|
|
Loading…
Reference in a new issue