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
6aa87f8c
Unverified
Commit
6aa87f8c
authored
4 years ago
by
Erik Johnston
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Ensure that we never stop reconnecting to redis (#9391)
parent
8a33d217
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
changelog.d/9391.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/9391.bugfix
synapse/replication/tcp/redis.py
+24
-2
24 additions, 2 deletions
synapse/replication/tcp/redis.py
with
25 additions
and
2 deletions
changelog.d/9391.bugfix
0 → 100644
+
1
−
0
View file @
6aa87f8c
Fix bug where Synapse would occaisonally stop reconnecting after the connection was lost.
This diff is collapsed.
Click to expand it.
synapse/replication/tcp/redis.py
+
24
−
2
View file @
6aa87f8c
...
...
@@ -15,8 +15,9 @@
import
logging
from
inspect
import
isawaitable
from
typing
import
TYPE_CHECKING
,
Optional
,
Type
,
cast
from
typing
import
TYPE_CHECKING
,
Generic
,
Optional
,
Type
,
TypeVar
,
cast
import
attr
import
txredisapi
from
synapse.logging.context
import
PreserveLoggingContext
,
make_deferred_yieldable
...
...
@@ -42,6 +43,24 @@ if TYPE_CHECKING:
logger
=
logging
.
getLogger
(
__name__
)
T
=
TypeVar
(
"
T
"
)
V
=
TypeVar
(
"
V
"
)
@attr.s
class
ConstantProperty
(
Generic
[
T
,
V
]):
"""
A descriptor that returns the given constant, ignoring attempts to set
it.
"""
constant
=
attr
.
ib
()
# type: V
def
__get__
(
self
,
obj
:
Optional
[
T
],
objtype
:
Type
[
T
]
=
None
)
->
V
:
return
self
.
constant
def
__set__
(
self
,
obj
:
Optional
[
T
],
value
:
V
):
pass
class
RedisSubscriber
(
txredisapi
.
SubscriberProtocol
,
AbstractConnection
):
"""
Connection to redis subscribed to replication stream.
...
...
@@ -195,6 +214,10 @@ class SynapseRedisFactory(txredisapi.RedisFactory):
we detect dead connections.
"""
# We want to *always* retry connecting, txredisapi will stop if there is a
# failure during certain operations, e.g. during AUTH.
continueTrying
=
cast
(
bool
,
ConstantProperty
(
True
))
def
__init__
(
self
,
hs
:
"
HomeServer
"
,
...
...
@@ -243,7 +266,6 @@ class RedisDirectTcpReplicationClientFactory(SynapseRedisFactory):
"""
maxDelay
=
5
continueTrying
=
True
protocol
=
RedisSubscriber
def
__init__
(
...
...
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