Support running synmark on macOS. (#8578)

By using the "poll" reactor since macOS doesn't support epoll.
This commit is contained in:
Patrick Cloke 2020-10-19 07:27:46 -04:00 committed by GitHub
parent 1fcdbeb3ab
commit 85c56445fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

1
changelog.d/8578.misc Normal file
View File

@ -0,0 +1 @@
Support macOS on the `synmark` benchmark runner.

View File

@ -15,7 +15,10 @@
import sys import sys
from twisted.internet import epollreactor try:
from twisted.internet.epollreactor import EPollReactor as Reactor
except ImportError:
from twisted.internet.pollreactor import PollReactor as Reactor
from twisted.internet.main import installReactor from twisted.internet.main import installReactor
from synapse.config.homeserver import HomeServerConfig from synapse.config.homeserver import HomeServerConfig
@ -63,7 +66,7 @@ def make_reactor():
Instantiate and install a Twisted reactor suitable for testing (i.e. not the Instantiate and install a Twisted reactor suitable for testing (i.e. not the
default global one). default global one).
""" """
reactor = epollreactor.EPollReactor() reactor = Reactor()
if "twisted.internet.reactor" in sys.modules: if "twisted.internet.reactor" in sys.modules:
del sys.modules["twisted.internet.reactor"] del sys.modules["twisted.internet.reactor"]