summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-10-04 09:09:16 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-10-04 09:15:58 -0700
commite96adc4bafd72aee7380020a6e1f92a055358d86 (patch)
tree97fb7b36ae2088ae36cd1d1c474c5de94d6232c2
parent52f92e891a09796ef4212ed355e8ce0faede9d79 (diff)
Go back to Twisted event loop
Urwid + asyncio has been known to have very high CPU usage for 4 years now, and it hasn't been fixed. That basically makes it impossible to switch event loops. We can still get the asyncio syntax goodness but using the twisted asyncioreactor and then initializing urwid with the Twisted loop which doesn't have this problem. Fixes #1302
-rw-r--r--alot/__main__.py3
-rw-r--r--alot/ui.py2
-rwxr-xr-xsetup.py1
3 files changed, 5 insertions, 1 deletions
diff --git a/alot/__main__.py b/alot/__main__.py
index 221e6b22..c901bb07 100644
--- a/alot/__main__.py
+++ b/alot/__main__.py
@@ -16,6 +16,9 @@ from alot.commands import *
from alot.commands import CommandParseError, COMMANDS
from alot.utils import argparse as cargparse
+from twisted.internet import asyncioreactor
+asyncioreactor.install()
+
_SUBCOMMANDS = ['search', 'compose', 'bufferlist', 'taglist', 'namedqueries',
'pyshell']
diff --git a/alot/ui.py b/alot/ui.py
index 013b4e7a..b528518f 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -115,7 +115,7 @@ class UI(object):
self.mainloop = urwid.MainLoop(
self.root_widget,
handle_mouse=settings.get('handle_mouse'),
- event_loop=urwid.AsyncioEventLoop(),
+ event_loop=urwid.TwistedEventLoop(),
unhandled_input=self._unhandled_input,
input_filter=self._input_filter)
diff --git a/setup.py b/setup.py
index 9c85a663..6c322404 100755
--- a/setup.py
+++ b/setup.py
@@ -48,6 +48,7 @@ setup(
'notmuch>=0.26',
'urwid>=1.3.0',
'urwidtrees>=1.0',
+ 'twisted>=10.2.0',
'python-magic',
'configobj>=4.7.0',
'gpg'