diff --git a/game/runner.py b/game/runner.py index a8327a7328..f7408c74ce 100644 --- a/game/runner.py +++ b/game/runner.py @@ -16,12 +16,12 @@ matter the value of this file. """ import os import sys -import time from optparse import OptionParser from subprocess import Popen import Queue, thread try: + # check if launched with pypy import __pypy__ as is_pypy except ImportError: is_pypy = False @@ -30,7 +30,6 @@ except ImportError: # System Configuration # - SERVER_PIDFILE = "server.pid" PORTAL_PIDFILE = "portal.pid" @@ -168,7 +167,6 @@ def start_services(server_argv, portal_argv): else: # normal operation: start portal as a daemon; we don't care to monitor it for restart PORTAL = Popen(portal_argv) - except IOError, e: print "Portal IOError: %s\nA possible explanation for this is that 'twistd' is not found." % e return diff --git a/src/commands/default/system.py b/src/commands/default/system.py index 56b48ff504..5ddba48cb5 100644 --- a/src/commands/default/system.py +++ b/src/commands/default/system.py @@ -694,7 +694,7 @@ class CmdServerLoad(MuxCommand): if not is_pypy: # Cache size measurements are not available on PyPy because it lacks sys.getsizeof - + # object cache size cachedict = _idmapper.cache_size() totcache = cachedict["_total"] diff --git a/src/scripts/scripts.py b/src/scripts/scripts.py index d773a58f95..6f7a6e9677 100644 --- a/src/scripts/scripts.py +++ b/src/scripts/scripts.py @@ -448,18 +448,19 @@ class ValidateChannelHandler(Script): #print "ValidateChannelHandler run." channelhandler.CHANNELHANDLER.update() -# PyPy does not support sys.getsizeof, so the attribute cache dump script is skipped here. -if not is_pypy: - class ClearAttributeCache(Script): - "Clear the attribute cache." - def at_script_creation(self): - "Setup the script" - self.key = "sys_cache_clear" - self.desc = _("Clears the Attribute Cache") - self.interval = 3600 * 2 - self.persistent = True - def at_repeat(self): - "called every 2 hours. Sets a max attr-cache limit to 100 MB." # enough for normal usage? - attr_cache_size, _, _ = caches.get_cache_sizes() - if attr_cache_size > _ATTRIBUTE_CACHE_MAXSIZE: - caches.flush_attr_cache() +class ClearAttributeCache(Script): + "Clear the attribute cache." + def at_script_creation(self): + "Setup the script" + self.key = "sys_cache_clear" + self.desc = _("Clears the Attribute Cache") + self.interval = 3600 * 2 + self.persistent = True + def at_repeat(self): + "called every 2 hours. Sets a max attr-cache limit to 100 MB." # enough for normal usage? + if is_pypy: + # pypy don't support get_size, so we have to skip out here. + return + attr_cache_size, _, _ = caches.get_cache_sizes() + if attr_cache_size > _ATTRIBUTE_CACHE_MAXSIZE: + caches.flush_attr_cache() diff --git a/src/utils/__init__.py b/src/utils/__init__.py index 4419d279dc..95c6c4fc23 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -1,3 +1,4 @@ +# simple check to determine if we are currently running under pypy. try: import __pypy__ as is_pypy except ImportError: