Mercurial > code > home > repos > homeauto
diff service/collector/sse_collector.py @ 595:7fd9fa5d33aa
standardize build. fix /state report
Ignore-this: 5a9bc82de9f0d7398c9290fc2c7ecbf9
author | drewp@bigasterisk.com |
---|---|
date | Sat, 06 Jul 2019 13:56:07 -0700 |
parents | 91ab9f926aa1 |
children | 22751570eda1 |
line wrap: on
line diff
--- a/service/collector/sse_collector.py Sat Jul 06 13:55:59 2019 -0700 +++ b/service/collector/sse_collector.py Sat Jul 06 13:56:07 2019 -0700 @@ -25,13 +25,11 @@ import cyclone.web, cyclone.sse import logging, collections, json, time -from logsetup import log, enableTwistedLog +from standardservice.logsetup import log, enableTwistedLog from patchablegraph import jsonFromPatch from rdfdb.patch import Patch -# workaround for broken import in twisted_sse_demo/eventsourcee.py -import sys; sys.path.append('twisted_sse_demo') -from patchsource import ReconnectingPatchSource +from patchablegraph.patchsource import ReconnectingPatchSource from sse_collector_config import config @@ -417,12 +415,12 @@ def get(self) -> None: try: state = self.settings.graphClients.state() - except: + self.write(json.dumps({'graphClients': state}, indent=2, + default=lambda obj: '<unserializable>')) + except Exception: import traceback; traceback.print_exc() raise - self.write(json.dumps({'graphClients': state}, indent=2)) - class Root(cyclone.web.RequestHandler): def get(self) -> None: