Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
1cf9e071
Unverified
Commit
1cf9e071
authored
7 years ago
by
Erik Johnston
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2899 from matrix-org/erikj/split_pushers
Split PusherStore
parents
d0957753
c2ecfcc3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/replication/slave/storage/pushers.py
+3
-9
3 additions, 9 deletions
synapse/replication/slave/storage/pushers.py
synapse/storage/pusher.py
+7
-4
7 additions, 4 deletions
synapse/storage/pusher.py
with
10 additions
and
13 deletions
synapse/replication/slave/storage/pushers.py
+
3
−
9
View file @
1cf9e071
# -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket Ltd
# Copyright 2018 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -16,10 +17,10 @@
from
._base
import
BaseSlavedStore
from
._slaved_id_tracker
import
SlavedIdTracker
from
synapse.storage
import
Data
Store
from
synapse.storage
.pusher
import
PusherWorker
Store
class
SlavedPusherStore
(
BaseSlavedStore
):
class
SlavedPusherStore
(
PusherWorkerStore
,
BaseSlavedStore
):
def
__init__
(
self
,
db_conn
,
hs
):
super
(
SlavedPusherStore
,
self
).
__init__
(
db_conn
,
hs
)
...
...
@@ -28,13 +29,6 @@ class SlavedPusherStore(BaseSlavedStore):
extra_tables
=
[(
"
deleted_pushers
"
,
"
stream_id
"
)],
)
get_all_pushers
=
DataStore
.
get_all_pushers
.
__func__
get_pushers_by
=
DataStore
.
get_pushers_by
.
__func__
get_pushers_by_app_id_and_pushkey
=
(
DataStore
.
get_pushers_by_app_id_and_pushkey
.
__func__
)
_decode_pushers_rows
=
DataStore
.
_decode_pushers_rows
.
__func__
def
stream_positions
(
self
):
result
=
super
(
SlavedPusherStore
,
self
).
stream_positions
()
result
[
"
pushers
"
]
=
self
.
_pushers_id_gen
.
get_current_token
()
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/pusher.py
+
7
−
4
View file @
1cf9e071
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -27,7 +28,7 @@ import types
logger
=
logging
.
getLogger
(
__name__
)
class
PusherStore
(
SQLBaseStore
):
class
Pusher
Worker
Store
(
SQLBaseStore
):
def
_decode_pushers_rows
(
self
,
rows
):
for
r
in
rows
:
dataJson
=
r
[
'
data
'
]
...
...
@@ -102,9 +103,6 @@ class PusherStore(SQLBaseStore):
rows
=
yield
self
.
runInteraction
(
"
get_all_pushers
"
,
get_pushers
)
defer
.
returnValue
(
rows
)
def
get_pushers_stream_token
(
self
):
return
self
.
_pushers_id_gen
.
get_current_token
()
def
get_all_updated_pushers
(
self
,
last_id
,
current_id
,
limit
):
if
last_id
==
current_id
:
return
defer
.
succeed
(([],
[]))
...
...
@@ -177,6 +175,11 @@ class PusherStore(SQLBaseStore):
"
get_all_updated_pushers_rows
"
,
get_all_updated_pushers_rows_txn
)
class
PusherStore
(
PusherWorkerStore
):
def
get_pushers_stream_token
(
self
):
return
self
.
_pushers_id_gen
.
get_current_token
()
@cachedInlineCallbacks
(
num_args
=
1
,
max_entries
=
15000
)
def
get_if_user_has_pusher
(
self
,
user_id
):
# This only exists for the cachedList decorator
...
...
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