From 6afb58c4c8c990e5124006ada1cf4fc2041e9af5 Mon Sep 17 00:00:00 2001 From: Ultrabug Date: Mon, 8 Apr 2013 17:22:57 +0200 Subject: handle SIGUSR1 for new threaded modules execution, drop useless globals --- py3status/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/py3status/__init__.py b/py3status/__init__.py index 79845a1..9605fa7 100755 --- a/py3status/__init__.py +++ b/py3status/__init__.py @@ -68,8 +68,6 @@ DISABLE_TRANSFORM = False I3STATUS_CONFIG = '/etc/i3status.conf' INCLUDE_PATH = '.i3/py3status' INTERVAL = 1 -USER_CACHE = {} -USER_CLASSES = {} # functions ################################################################################ @@ -340,6 +338,13 @@ class UserModules(Thread): """ self.kill = True + def clear(self): + """ + clear user cache + """ + self.cache = {} + print self.cache + def run(self): """ periodically execute user classes @@ -358,7 +363,7 @@ def main(): try: # global definition global CACHE_TIMEOUT, DISABLE_TRANSFORM - global I3STATUS_CONFIG, INCLUDE_PATH, INTERVAL, USER_CACHE, USER_CLASSES + global I3STATUS_CONFIG, INCLUDE_PATH, INTERVAL # command line options parser = argparse.ArgumentParser( @@ -477,7 +482,7 @@ def main(): msg = sys.exc_info()[1] syslog(LOG_INFO, str(msg)) call(["killall", "-s", "USR1", "i3status"]) - USER_CACHE = {} + modules_thread.clear() forced = True except KeyboardInterrupt: break -- cgit v1.3