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
a7f20500
Commit
a7f20500
authored
5 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
_CURRENT_STATE_CACHE_NAME is public
parent
00f0d675
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/replication/slave/storage/_base.py
+2
-2
2 additions, 2 deletions
synapse/replication/slave/storage/_base.py
synapse/storage/data_stores/main/cache.py
+3
-3
3 additions, 3 deletions
synapse/storage/data_stores/main/cache.py
with
5 additions
and
5 deletions
synapse/replication/slave/storage/_base.py
+
2
−
2
View file @
a7f20500
...
@@ -19,7 +19,7 @@ from typing import Dict
...
@@ -19,7 +19,7 @@ from typing import Dict
import
six
import
six
from
synapse.storage._base
import
SQLBaseStore
from
synapse.storage._base
import
SQLBaseStore
from
synapse.storage.data_stores.main.cache
import
_
CURRENT_STATE_CACHE_NAME
from
synapse.storage.data_stores.main.cache
import
CURRENT_STATE_CACHE_NAME
from
synapse.storage.engines
import
PostgresEngine
from
synapse.storage.engines
import
PostgresEngine
from
._slaved_id_tracker
import
SlavedIdTracker
from
._slaved_id_tracker
import
SlavedIdTracker
...
@@ -63,7 +63,7 @@ class BaseSlavedStore(SQLBaseStore):
...
@@ -63,7 +63,7 @@ class BaseSlavedStore(SQLBaseStore):
if
stream_name
==
"
caches
"
:
if
stream_name
==
"
caches
"
:
self
.
_cache_id_gen
.
advance
(
token
)
self
.
_cache_id_gen
.
advance
(
token
)
for
row
in
rows
:
for
row
in
rows
:
if
row
.
cache_func
==
_
CURRENT_STATE_CACHE_NAME
:
if
row
.
cache_func
==
CURRENT_STATE_CACHE_NAME
:
room_id
=
row
.
keys
[
0
]
room_id
=
row
.
keys
[
0
]
members_changed
=
set
(
row
.
keys
[
1
:])
members_changed
=
set
(
row
.
keys
[
1
:])
self
.
_invalidate_state_caches
(
room_id
,
members_changed
)
self
.
_invalidate_state_caches
(
room_id
,
members_changed
)
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/data_stores/main/cache.py
+
3
−
3
View file @
a7f20500
...
@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
...
@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
# This is a special cache name we use to batch multiple invalidations of caches
# This is a special cache name we use to batch multiple invalidations of caches
# based on the current state when notifying workers over replication.
# based on the current state when notifying workers over replication.
_
CURRENT_STATE_CACHE_NAME
=
"
cs_cache_fake
"
CURRENT_STATE_CACHE_NAME
=
"
cs_cache_fake
"
class
CacheInvalidationStore
(
SQLBaseStore
):
class
CacheInvalidationStore
(
SQLBaseStore
):
...
@@ -65,12 +65,12 @@ class CacheInvalidationStore(SQLBaseStore):
...
@@ -65,12 +65,12 @@ class CacheInvalidationStore(SQLBaseStore):
for
chunk
in
batch_iter
(
members_changed
,
50
):
for
chunk
in
batch_iter
(
members_changed
,
50
):
keys
=
itertools
.
chain
([
room_id
],
chunk
)
keys
=
itertools
.
chain
([
room_id
],
chunk
)
self
.
_send_invalidation_to_replication
(
self
.
_send_invalidation_to_replication
(
txn
,
_
CURRENT_STATE_CACHE_NAME
,
keys
txn
,
CURRENT_STATE_CACHE_NAME
,
keys
)
)
else
:
else
:
# if no members changed, we still need to invalidate the other caches.
# if no members changed, we still need to invalidate the other caches.
self
.
_send_invalidation_to_replication
(
self
.
_send_invalidation_to_replication
(
txn
,
_
CURRENT_STATE_CACHE_NAME
,
[
room_id
]
txn
,
CURRENT_STATE_CACHE_NAME
,
[
room_id
]
)
)
def
_send_invalidation_to_replication
(
self
,
txn
,
cache_name
,
keys
):
def
_send_invalidation_to_replication
(
self
,
txn
,
cache_name
,
keys
):
...
...
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