Skip to content

Commit

Permalink
Reduce variation in Pykka imports
Browse files Browse the repository at this point in the history
Which lets us reduce the amount of mocked modules when building docs
  • Loading branch information
jodal committed Feb 7, 2016
1 parent 95b2159 commit 78d10c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
3 changes: 0 additions & 3 deletions docs/conf.py
Expand Up @@ -41,9 +41,6 @@ def __getattr__(self, name):
'dbus.service',
'mopidy.internal.gi',
'pykka',
'pykka.actor',
'pykka.future',
'pykka.registry',
]
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = Mock()
Expand Down
13 changes: 6 additions & 7 deletions mopidy/internal/process.py
Expand Up @@ -4,8 +4,7 @@
import signal
import threading

from pykka import ActorDeadError
from pykka.registry import ActorRegistry
import pykka

from mopidy.compat import thread

Expand All @@ -31,14 +30,14 @@ def exit_handler(signum, frame):


def stop_actors_by_class(klass):
actors = ActorRegistry.get_by_class(klass)
actors = pykka.ActorRegistry.get_by_class(klass)
logger.debug('Stopping %d instance(s) of %s', len(actors), klass.__name__)
for actor in actors:
actor.stop()


def stop_remaining_actors():
num_actors = len(ActorRegistry.get_all())
num_actors = len(pykka.ActorRegistry.get_all())
while num_actors:
logger.error(
'There are actor threads still running, this is probably a bug')
Expand All @@ -47,8 +46,8 @@ def stop_remaining_actors():
num_actors, threading.active_count() - num_actors,
', '.join([t.name for t in threading.enumerate()]))
logger.debug('Stopping %d actor(s)...', num_actors)
ActorRegistry.stop_all()
num_actors = len(ActorRegistry.get_all())
pykka.ActorRegistry.stop_all()
num_actors = len(pykka.ActorRegistry.get_all())
logger.debug('All actors stopped.')


Expand All @@ -67,7 +66,7 @@ def run(self):
logger.info('Interrupted by user')
except ImportError as e:
logger.error(e)
except ActorDeadError as e:
except pykka.ActorDeadError as e:
logger.warning(e)
except Exception as e:
logger.exception(e)
Expand Down

0 comments on commit 78d10c4

Please sign in to comment.