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
0e07f2e1
Commit
0e07f2e1
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Only fetch events for rooms and receipts
parent
82b46f55
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
synapse/handlers/events.py
+3
-3
3 additions, 3 deletions
synapse/handlers/events.py
synapse/notifier.py
+3
-3
3 additions, 3 deletions
synapse/notifier.py
synapse/push/__init__.py
+2
-1
2 additions, 1 deletion
synapse/push/__init__.py
with
8 additions
and
7 deletions
synapse/handlers/events.py
+
3
−
3
View file @
0e07f2e1
...
@@ -113,10 +113,10 @@ class EventStreamHandler(BaseHandler):
...
@@ -113,10 +113,10 @@ class EventStreamHandler(BaseHandler):
@log_function
@log_function
def
get_stream
(
self
,
auth_user_id
,
pagin_config
,
timeout
=
0
,
def
get_stream
(
self
,
auth_user_id
,
pagin_config
,
timeout
=
0
,
as_client_event
=
True
,
affect_presence
=
True
,
as_client_event
=
True
,
affect_presence
=
True
,
only_
room_events
=
Fals
e
,
room_id
=
None
,
is_guest
=
False
):
only_
keys
=
Non
e
,
room_id
=
None
,
is_guest
=
False
):
"""
Fetches the events stream for a given user.
"""
Fetches the events stream for a given user.
If `only_
room_events` is `True` only
ro
o
m
event
s will be
returned
.
If `only_
keys` is not None, events f
rom
key
s will be
sent down
.
"""
"""
auth_user
=
UserID
.
from_string
(
auth_user_id
)
auth_user
=
UserID
.
from_string
(
auth_user_id
)
...
@@ -134,7 +134,7 @@ class EventStreamHandler(BaseHandler):
...
@@ -134,7 +134,7 @@ class EventStreamHandler(BaseHandler):
events
,
tokens
=
yield
self
.
notifier
.
get_events_for
(
events
,
tokens
=
yield
self
.
notifier
.
get_events_for
(
auth_user
,
pagin_config
,
timeout
,
auth_user
,
pagin_config
,
timeout
,
only_
room_events
=
only_room_event
s
,
only_
keys
=
only_key
s
,
is_guest
=
is_guest
,
explicit_room_id
=
room_id
is_guest
=
is_guest
,
explicit_room_id
=
room_id
)
)
...
...
This diff is collapsed.
Click to expand it.
synapse/notifier.py
+
3
−
3
View file @
0e07f2e1
...
@@ -331,13 +331,13 @@ class Notifier(object):
...
@@ -331,13 +331,13 @@ class Notifier(object):
@defer.inlineCallbacks
@defer.inlineCallbacks
def
get_events_for
(
self
,
user
,
pagination_config
,
timeout
,
def
get_events_for
(
self
,
user
,
pagination_config
,
timeout
,
only_
room_events
=
Fals
e
,
only_
keys
=
Non
e
,
is_guest
=
False
,
explicit_room_id
=
None
):
is_guest
=
False
,
explicit_room_id
=
None
):
"""
For the given user and rooms, return any new events for them. If
"""
For the given user and rooms, return any new events for them. If
there are no new events wait for up to `timeout` milliseconds for any
there are no new events wait for up to `timeout` milliseconds for any
new events to happen before returning.
new events to happen before returning.
If `only_
room_events` is `True` only
ro
o
m
event
s will be
returned
.
If `only_
keys` is not None, events f
rom
key
s will be
sent down
.
If explicit_room_id is not set, the user
'
s joined rooms will be polled
If explicit_room_id is not set, the user
'
s joined rooms will be polled
for events.
for events.
...
@@ -367,7 +367,7 @@ class Notifier(object):
...
@@ -367,7 +367,7 @@ class Notifier(object):
after_id
=
getattr
(
after_token
,
keyname
)
after_id
=
getattr
(
after_token
,
keyname
)
if
before_id
==
after_id
:
if
before_id
==
after_id
:
continue
continue
if
only_
room_event
s
and
name
!=
"
room
"
:
if
only_
key
s
and
name
not
in
only_keys
:
continue
continue
new_events
,
new_key
=
yield
source
.
get_new_events
(
new_events
,
new_key
=
yield
source
.
get_new_events
(
user
=
user
,
user
=
user
,
...
...
This diff is collapsed.
Click to expand it.
synapse/push/__init__.py
+
2
−
1
View file @
0e07f2e1
...
@@ -126,7 +126,8 @@ class Pusher(object):
...
@@ -126,7 +126,8 @@ class Pusher(object):
config
=
PaginationConfig
(
from_token
=
from_tok
,
limit
=
'
1
'
)
config
=
PaginationConfig
(
from_token
=
from_tok
,
limit
=
'
1
'
)
timeout
=
(
300
+
random
.
randint
(
-
60
,
60
))
*
1000
timeout
=
(
300
+
random
.
randint
(
-
60
,
60
))
*
1000
chunk
=
yield
self
.
evStreamHandler
.
get_stream
(
chunk
=
yield
self
.
evStreamHandler
.
get_stream
(
self
.
user_id
,
config
,
timeout
=
timeout
,
affect_presence
=
False
self
.
user_id
,
config
,
timeout
=
timeout
,
affect_presence
=
False
,
only_keys
=
(
"
room
"
,
"
receipt
"
,),
)
)
# limiting to 1 may get 1 event plus 1 presence event, so
# limiting to 1 may get 1 event plus 1 presence event, so
...
...
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