comparison service/environment/environment.py @ 1708:3cfd3693a4ac

quick fixes for cyclone sse
author drewp@bigasterisk.com
date Wed, 17 Nov 2021 14:25:14 -0800
parents 4167101b816f
children
comparison
equal deleted inserted replaced
1707:4a6fffe6a994 1708:3cfd3693a4ac
13 from greplin import scales 13 from greplin import scales
14 from greplin.scales.cyclonehandler import StatsHandler 14 from greplin.scales.cyclonehandler import StatsHandler
15 from patchablegraph import PatchableGraph, CycloneGraphEventsHandler, CycloneGraphHandler 15 from patchablegraph import PatchableGraph, CycloneGraphEventsHandler, CycloneGraphHandler
16 from twilight import isWithinTwilight 16 from twilight import isWithinTwilight
17 from standardservice.logsetup import log, verboseLogging 17 from standardservice.logsetup import log, verboseLogging
18 18 from patch_cyclone import patch_sse
19 from rdfdoc import Doc 19 from rdfdoc import Doc
20 patch_sse()
20 21
21 ROOM = Namespace("http://projects.bigasterisk.com/room/") 22 ROOM = Namespace("http://projects.bigasterisk.com/room/")
22 DEV = Namespace("http://projects.bigasterisk.com/device/") 23 DEV = Namespace("http://projects.bigasterisk.com/device/")
23 24
24 STATS = scales.collection('/root', 25 STATS = scales.collection('/root',
25 scales.PmfStat('update'), 26 scales.PmfStat('update'),
26 ) 27 )
27 28
28 class CycloneGraphEventsHandlerWithCors(CycloneGraphEventsHandler): 29 class CycloneGraphEventsHandlerWithCors(CycloneGraphEventsHandler):
29 def flush(self): 30 def flush(self):
30 self.set_header("Access-Control-Allow-Origin", "*") 31 self.set_header(b"Access-Control-Allow-Origin", b"*")
31 return CycloneGraphEventsHandler.flush(self) 32 return CycloneGraphEventsHandler.flush(self)
32 33
33 34
34 @STATS.update.time() 35 @STATS.update.time()
35 def update(masterGraph): 36 def update(masterGraph):