Changes for small performance things
This commit is contained in:
parent
63d23a4c8a
commit
05b99203b1
3 changed files with 25 additions and 5 deletions
|
@ -74,6 +74,8 @@ class CentralCommand(object):
|
|||
self.args = args # cli args
|
||||
|
||||
self.timer = Stopwatch()
|
||||
|
||||
self.hugveyWarnings = {}
|
||||
|
||||
eventLogger.addHandler(logging.handlers.QueueHandler(self.logQueue))
|
||||
|
||||
|
@ -159,6 +161,8 @@ class CentralCommand(object):
|
|||
status['duration'] = 0 if not hv.story else hv.story.timer.getElapsed()
|
||||
status['has_state'] = Story.hugveyHasSavedState(hv.lightId)
|
||||
status['variables'] = {} if not isSelected or not hv.story else hv.story.variableValues
|
||||
|
||||
# evLogger = eventLogger.getChild(f"{hv_id}")
|
||||
|
||||
if not hv.story:
|
||||
status['time_since_hugvey_spoke'] = '-'
|
||||
|
@ -169,12 +173,28 @@ class CentralCommand(object):
|
|||
elif not hasattr(hv.story, 'lastMsgFinishTime') or not hv.story.lastMsgFinishTime:
|
||||
status['time_since_hugvey_spoke'] = 'speaking'
|
||||
else:
|
||||
status['time_since_hugvey_spoke'] = str(datetime.timedelta(seconds=int(hv.story.timer.getElapsed() - hv.story.lastMsgFinishTime)))
|
||||
diff = datetime.timedelta(seconds=int(hv.story.timer.getElapsed() - hv.story.lastMsgFinishTime))
|
||||
status['time_since_hugvey_spoke'] = str(diff)
|
||||
# if diff > 300:
|
||||
# evLogger.warning("Very long time since hugvey spoke")
|
||||
# elif diff > 100:
|
||||
# evLogger.warning("Long time since hugvey spoke")
|
||||
# else:
|
||||
# #clear warning
|
||||
# pass
|
||||
|
||||
if not hv.story.timer.hasMark('last_speech'):
|
||||
status['time_since_visitor_spoke'] = 'never'
|
||||
else:
|
||||
status['time_since_visitor_spoke'] = str(datetime.timedelta(seconds=int(hv.story.timer.getElapsed('last_speech'))))
|
||||
diff = datetime.timedelta(seconds=int(hv.story.timer.getElapsed('last_speech')))
|
||||
status['time_since_visitor_spoke'] = str(diff)
|
||||
# if diff > 300:
|
||||
# evLogger.warning("Very long time since audience spoke")
|
||||
# elif diff > 100:
|
||||
# evLogger.warning("Long time since audience spoke")
|
||||
# else:
|
||||
# #clear warning
|
||||
# pass
|
||||
|
||||
return status
|
||||
|
||||
|
|
|
@ -2016,7 +2016,7 @@ class Story(object):
|
|||
@classmethod
|
||||
def getStateDir(self):
|
||||
# return "/tmp"
|
||||
return "./recordings"
|
||||
return "./state"
|
||||
# day = time.strftime("%Y%m%d")
|
||||
# t = time.strftime("%H:%M:%S")
|
||||
#
|
||||
|
|
|
@ -42,8 +42,8 @@ if __name__ == '__main__':
|
|||
logger = logging.getLogger("hugvey")
|
||||
|
||||
logFileHandler = logging.handlers.RotatingFileHandler(
|
||||
'./recordings/server.log',
|
||||
maxBytes=1024*512,
|
||||
'./state/server.log',
|
||||
maxBytes=1024*5120,
|
||||
backupCount=5
|
||||
)
|
||||
logFileHandler.setFormatter(logging.Formatter(
|
||||
|
|
Loading…
Reference in a new issue