Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
97d1a1dc
Unverified
Commit
97d1a1dc
authored
7 years ago
by
Richard van der Hoff
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2718 from matrix-org/rav/notify_logcontexts
Clear logcontext before starting fed txn queue runner
parents
8b45de90
d4fb4f7c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/federation/transaction_queue.py
+8
-2
8 additions, 2 deletions
synapse/federation/transaction_queue.py
synapse/notifier.py
+10
-7
10 additions, 7 deletions
synapse/notifier.py
with
18 additions
and
9 deletions
synapse/federation/transaction_queue.py
+
8
−
2
View file @
97d1a1dc
...
...
@@ -20,7 +20,7 @@ from .persistence import TransactionActions
from
.units
import
Transaction
,
Edu
from
synapse.api.errors
import
HttpResponseException
from
synapse.util
import
logcontext
from
synapse.util
import
logcontext
,
PreserveLoggingContext
from
synapse.util.async
import
run_on_reactor
from
synapse.util.retryutils
import
NotRetryingDestination
,
get_retry_limiter
from
synapse.util.metrics
import
measure_func
...
...
@@ -146,7 +146,6 @@ class TransactionQueue(object):
else
:
return
not
destination
.
startswith
(
"
localhost
"
)
@defer.inlineCallbacks
def
notify_new_events
(
self
,
current_id
):
"""
This gets called when we have some new events we might want to
send out to other servers.
...
...
@@ -156,6 +155,13 @@ class TransactionQueue(object):
if
self
.
_is_processing
:
return
# fire off a processing loop in the background. It's likely it will
# outlast the current request, so run it in the sentinel logcontext.
with
PreserveLoggingContext
():
self
.
_process_event_queue_loop
()
@defer.inlineCallbacks
def
_process_event_queue_loop
(
self
):
try
:
self
.
_is_processing
=
True
while
True
:
...
...
This diff is collapsed.
Click to expand it.
synapse/notifier.py
+
10
−
7
View file @
97d1a1dc
...
...
@@ -255,9 +255,7 @@ class Notifier(object):
)
if
self
.
federation_sender
:
preserve_fn
(
self
.
federation_sender
.
notify_new_events
)(
room_stream_id
)
self
.
federation_sender
.
notify_new_events
(
room_stream_id
)
if
event
.
type
==
EventTypes
.
Member
and
event
.
membership
==
Membership
.
JOIN
:
self
.
_user_joined_room
(
event
.
state_key
,
event
.
room_id
)
...
...
@@ -297,8 +295,7 @@ class Notifier(object):
def
on_new_replication_data
(
self
):
"""
Used to inform replication listeners that something has happend
without waking up any of the normal user event streams
"""
with
PreserveLoggingContext
():
self
.
notify_replication
()
self
.
notify_replication
()
@defer.inlineCallbacks
def
wait_for_events
(
self
,
user_id
,
timeout
,
callback
,
room_ids
=
None
,
...
...
@@ -516,8 +513,14 @@ class Notifier(object):
self
.
replication_deferred
=
ObservableDeferred
(
defer
.
Deferred
())
deferred
.
callback
(
None
)
for
cb
in
self
.
replication_callbacks
:
preserve_fn
(
cb
)()
# the callbacks may well outlast the current request, so we run
# them in the sentinel logcontext.
#
# (ideally it would be up to the callbacks to know if they were
# starting off background processes and drop the logcontext
# accordingly, but that requires more changes)
for
cb
in
self
.
replication_callbacks
:
cb
()
@defer.inlineCallbacks
def
wait_for_replication
(
self
,
callback
,
timeout
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment