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
2ce27a24
Unverified
Commit
2ce27a24
authored
3 years ago
by
Erik Johnston
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add experimental environment variable to enable asyncio reactor (#12135)
parent
ca9234a9
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
changelog.d/12135.feature
+1
-0
1 addition, 0 deletions
changelog.d/12135.feature
mypy.ini
+3
-0
3 additions, 0 deletions
mypy.ini
synapse/__init__.py
+21
-0
21 additions, 0 deletions
synapse/__init__.py
with
25 additions
and
0 deletions
changelog.d/12135.feature
0 → 100644
+
1
−
0
View file @
2ce27a24
Add
experimental
env
var
`SYNAPSE_ASYNC_IO_REACTOR`
that
causes
Synapse
to
use
the
asyncio
reactor
for
Twisted.
This diff is collapsed.
Click to expand it.
mypy.ini
+
3
−
0
View file @
2ce27a24
...
...
@@ -353,3 +353,6 @@ ignore_missing_imports = True
[mypy-zope]
ignore_missing_imports
=
True
[mypy-incremental.*]
ignore_missing_imports
=
True
This diff is collapsed.
Click to expand it.
synapse/__init__.py
+
21
−
0
View file @
2ce27a24
...
...
@@ -25,6 +25,27 @@ if sys.version_info < (3, 7):
print
(
"
Synapse requires Python 3.7 or above.
"
)
sys
.
exit
(
1
)
# Allow using the asyncio reactor via env var.
if
bool
(
os
.
environ
.
get
(
"
SYNAPSE_ASYNC_IO_REACTOR
"
,
False
)):
try
:
from
incremental
import
Version
import
twisted
# We need a bugfix that is included in Twisted 21.2.0:
# https://twistedmatrix.com/trac/ticket/9787
if
twisted
.
version
<
Version
(
"
Twisted
"
,
21
,
2
,
0
):
print
(
"
Using asyncio reactor requires Twisted>=21.2.0
"
)
sys
.
exit
(
1
)
import
asyncio
from
twisted.internet
import
asyncioreactor
asyncioreactor
.
install
(
asyncio
.
get_event_loop
())
except
ImportError
:
pass
# Twisted and canonicaljson will fail to import when this file is executed to
# get the __version__ during a fresh install. That's OK and subsequent calls to
# actually start Synapse will import these libraries fine.
...
...
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