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
Package registry
Container Registry
Model registry
Operate
Terraform modules
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
Timo Ley
synapse
Commits
9af43225
Commit
9af43225
authored
9 years ago
by
Mark Haines
Browse files
Options
Downloads
Patches
Plain Diff
Don't set a timer if there's already a result to return
parent
df6db5c8
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
+10
-3
10 additions, 3 deletions
synapse/notifier.py
with
10 additions
and
3 deletions
synapse/notifier.py
+
10
−
3
View file @
9af43225
...
@@ -82,9 +82,10 @@ class _NotifierUserStream(object):
...
@@ -82,9 +82,10 @@ class _NotifierUserStream(object):
self
.
current_token
=
self
.
current_token
.
copy_and_replace
(
self
.
current_token
=
self
.
current_token
.
copy_and_replace
(
stream_key
,
stream_id
stream_key
,
stream_id
)
)
for
listener
in
self
.
listeners
:
listeners
=
self
.
listeners
self
.
listeners
=
set
()
for
listener
in
listeners
:
listener
.
notify
(
self
.
current_token
)
listener
.
notify
(
self
.
current_token
)
self
.
listeners
.
clear
()
def
remove
(
self
,
notifier
):
def
remove
(
self
,
notifier
):
"""
Remove this listener from all the indexes in the Notifier
"""
Remove this listener from all the indexes in the Notifier
...
@@ -202,7 +203,7 @@ class Notifier(object):
...
@@ -202,7 +203,7 @@ class Notifier(object):
user_streams
=
room_user_streams
.
copy
()
user_streams
=
room_user_streams
.
copy
()
for
user
in
extra_users
:
for
user
in
extra_users
:
user_stream
=
self
.
user_to_user_stream
.
get
(
user
)
user_stream
=
self
.
user_to_user_stream
.
get
(
str
(
user
)
)
if
user_stream
is
not
None
:
if
user_stream
is
not
None
:
user_streams
.
add
(
user_stream
)
user_streams
.
add
(
user_stream
)
...
@@ -288,12 +289,18 @@ class Notifier(object):
...
@@ -288,12 +289,18 @@ class Notifier(object):
timer
=
[
None
]
timer
=
[
None
]
if
result
:
user_stream
.
listeners
.
discard
(
listener
[
0
])
defer
.
returnValue
(
result
)
return
if
timeout
:
if
timeout
:
timed_out
=
[
False
]
timed_out
=
[
False
]
def
_timeout_listener
():
def
_timeout_listener
():
timed_out
[
0
]
=
True
timed_out
[
0
]
=
True
timer
[
0
]
=
None
timer
[
0
]
=
None
user_stream
.
listeners
.
discard
(
listener
[
0
])
listener
[
0
].
notify
(
from_token
)
listener
[
0
].
notify
(
from_token
)
# We create multiple notification listeners so we have to manage
# We create multiple notification listeners so we have to manage
...
...
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