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
daa10e3e
Commit
daa10e3e
authored
6 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused `wait_for_replication` method
I guess this was used once? It's not now, anyway.
parent
8e28bc5e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/notifier.py
+0
-50
0 additions, 50 deletions
synapse/notifier.py
with
0 additions
and
50 deletions
synapse/notifier.py
+
0
−
50
View file @
daa10e3e
...
@@ -178,8 +178,6 @@ class Notifier(object):
...
@@ -178,8 +178,6 @@ class Notifier(object):
self
.
remove_expired_streams
,
self
.
UNUSED_STREAM_EXPIRY_MS
self
.
remove_expired_streams
,
self
.
UNUSED_STREAM_EXPIRY_MS
)
)
self
.
replication_deferred
=
ObservableDeferred
(
defer
.
Deferred
())
# This is not a very cheap test to perform, but it's only executed
# This is not a very cheap test to perform, but it's only executed
# when rendering the metrics page, which is likely once per minute at
# when rendering the metrics page, which is likely once per minute at
# most when scraping it.
# most when scraping it.
...
@@ -518,10 +516,6 @@ class Notifier(object):
...
@@ -518,10 +516,6 @@ class Notifier(object):
def
notify_replication
(
self
):
def
notify_replication
(
self
):
"""
Notify the any replication listeners that there
'
s a new event
"""
"""
Notify the any replication listeners that there
'
s a new event
"""
with
PreserveLoggingContext
():
with
PreserveLoggingContext
():
deferred
=
self
.
replication_deferred
self
.
replication_deferred
=
ObservableDeferred
(
defer
.
Deferred
())
deferred
.
callback
(
None
)
# the callbacks may well outlast the current request, so we run
# the callbacks may well outlast the current request, so we run
# them in the sentinel logcontext.
# them in the sentinel logcontext.
#
#
...
@@ -530,47 +524,3 @@ class Notifier(object):
...
@@ -530,47 +524,3 @@ class Notifier(object):
# accordingly, but that requires more changes)
# accordingly, but that requires more changes)
for
cb
in
self
.
replication_callbacks
:
for
cb
in
self
.
replication_callbacks
:
cb
()
cb
()
@defer.inlineCallbacks
def
wait_for_replication
(
self
,
callback
,
timeout
):
"""
Wait for an event to happen.
Args:
callback: Gets called whenever an event happens. If this returns a
truthy value then ``wait_for_replication`` returns, otherwise
it waits for another event.
timeout: How many milliseconds to wait for callback return a truthy
value.
Returns:
A deferred that resolves with the value returned by the callback.
"""
listener
=
_NotificationListener
(
None
)
end_time
=
self
.
clock
.
time_msec
()
+
timeout
while
True
:
listener
.
deferred
=
self
.
replication_deferred
.
observe
()
result
=
yield
callback
()
if
result
:
break
now
=
self
.
clock
.
time_msec
()
if
end_time
<=
now
:
break
listener
.
deferred
=
timeout_deferred
(
listener
.
deferred
,
timeout
=
(
end_time
-
now
)
/
1000.
,
reactor
=
self
.
hs
.
get_reactor
(),
)
try
:
with
PreserveLoggingContext
():
yield
listener
.
deferred
except
defer
.
TimeoutError
:
break
except
defer
.
CancelledError
:
break
defer
.
returnValue
(
result
)
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