Skip to content

Commit

Permalink
fix timer logging condition that broke everything
Browse files Browse the repository at this point in the history
  • Loading branch information
zim514 committed Jul 16, 2019
1 parent b1200d8 commit d25aa6c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion script.service.hue/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<addon id="script.service.hue" name="Hue Service"
provider-name="zim514" version="0.6.3">
provider-name="zim514" version="0.6.4">

<requires>
<import addon="xbmc.python" version="2.26.0" />
Expand Down
4 changes: 2 additions & 2 deletions script.service.hue/resources/lib/AmbiGroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _ambiUpdate(self,cap):
x = Thread(target=self._updateHueRGB,name="updateHue", args=(colors[colorIndex].rgb.r,colors[colorIndex].rgb.g,colors[colorIndex].rgb.b,L,self.transitionTime))
x.daemon = True
x.start()
@timer

def _updateHueRGB(self,r,g,b,light,transitionTime):
#startTime = time.time()

Expand Down Expand Up @@ -191,7 +191,7 @@ def _updateHueRGB(self,r,g,b,light,transitionTime):
#logger.debug("time: {},distance: {}".format(int((endTime-startTime)*1000),distance))
self.ambiLights[light].update(prevxy=xy)

@timer

def _updateHueXY(self,xy,light,transitionTime):
#startTime = time.time()

Expand Down
12 changes: 6 additions & 6 deletions script.service.hue/resources/lib/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@


def timer(func):
"""Print the runtime of the decorated function"""
"""Logs the runtime of the decorated function"""
@functools.wraps(func)
def wrapper_timer(*args, **kwargs):
startTime = time.time() # 1
value = func(*args, **kwargs)
endTime = time.time() # 2
runTime = endTime - startTime # 3
if performanceLogging == True:
startTime = time.time() # 1
value = func(*args, **kwargs)
endTime = time.time() # 2
runTime = endTime - startTime # 3
logger.debug("[script.service.hue][{}] Completed in {:02f}ms".format(func.__name__,runTime*1000))
return value
return value
return wrapper_timer

0 comments on commit d25aa6c

Please sign in to comment.