commit 48198becfdae7d6bc1d68862076a3c054246375e Author: Damian Johnson atagar@torproject.org Date: Sat Jan 30 18:45:29 2016 -0800
Cache 'GETINFO address' queries
Very, very highly used GETINFO query. We can't legitimately make this cached in Stem since it can change but for Nyx it's a risk I'm willing to take. --- nyx/util/__init__.py | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/nyx/util/__init__.py b/nyx/util/__init__.py index 12b5ace..0f53ab6 100644 --- a/nyx/util/__init__.py +++ b/nyx/util/__init__.py @@ -7,6 +7,7 @@ import os import sys
import stem.connection +import stem.control import stem.util.conf import stem.util.log
@@ -26,6 +27,10 @@ BASE_DIR = os.path.sep.join(__file__.split(os.path.sep)[:-2]) DATA_DIR = os.path.expanduser('~/.nyx') TESTING = False
+# technically can change but we use this query a *lot* so needs to be cached + +stem.control.CACHEABLE_GETINFO_PARAMS = list(stem.control.CACHEABLE_GETINFO_PARAMS) + ['address'] + try: uses_settings = stem.util.conf.uses_settings('nyx', os.path.join(BASE_DIR, 'config'), lazy_load = False) except IOError as exc:
tor-commits@lists.torproject.org