Fix some performance regressions

Move YAML load down into function and keep it out of module space

The get_event() call incurs a 1s penelty on all LocalClient
initalizations. Removed.
This commit is contained in:
Mike Place 2015-01-21 11:48:14 -07:00
parent 7ea840fbe1
commit 9bfe83b7b0
2 changed files with 2 additions and 6 deletions

View File

@ -105,8 +105,6 @@ from salt.exceptions import (
SaltInvocationError SaltInvocationError
) )
# Import third party libs
import yaml
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
_empty = object() _empty = object()
@ -137,6 +135,8 @@ def get_color_theme(theme):
''' '''
Return the color theme to use Return the color theme to use
''' '''
# Keep the heavy lifting out of the module space
import yaml
if not os.path.isfile(theme): if not os.path.isfile(theme):
log.warning('The named theme {0} if not available'.format(theme)) log.warning('The named theme {0} if not available'.format(theme))
try: try:

View File

@ -175,10 +175,6 @@ class SaltEvent(object):
self.pending_events = [] self.pending_events = []
self.__load_cache_regex() self.__load_cache_regex()
# since ZMQ connect() has no guarantees about the socket actually being
# connected this is a hack to attempt to do so.
self.get_event(wait=1)
@classmethod @classmethod
def __load_cache_regex(cls): def __load_cache_regex(cls):
''' '''