[Pkg-bitcoin-commits] [python-quamash] 50/78: Better performances
Jonas Smedegaard
dr at jones.dk
Tue Dec 19 01:19:55 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/0.6.0_dfsg-1
in repository python-quamash.
commit 40cc27e6a2ff47668f75c672917ea9af3fa541a2
Author: inso <insomniak.fr at gmaiL.com>
Date: Thu Nov 16 19:46:30 2017 +0100
Better performances
---
quamash/__init__.py | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/quamash/__init__.py b/quamash/__init__.py
index 260420a..596ec5b 100644
--- a/quamash/__init__.py
+++ b/quamash/__init__.py
@@ -190,24 +190,26 @@ class _SimpleTimer(QtCore.QObject):
def timerEvent(self, event): # noqa
timerid = event.timerId()
- #self._logger.debug("Timer event on id {0}".format(timerid))
+ self._logger.debug("Timer event on id {0}".format(timerid))
if self._stopped:
- #self._logger.debug("Timer stopped, killing {}".format(timerid))
- self.__callbacks.pop(timerid)
+ self._logger.debug("Timer stopped, killing {}".format(timerid))
self.killTimer(timerid)
+ del self.__callbacks[timerid]
else:
try:
- handle = self.__callbacks.pop(timerid)
+ handle = self.__callbacks[timerid]
except KeyError as e :
self._logger.debug(str(e))
pass
else:
if handle._cancelled:
- pass
- #self._logger.debug("Handle {} cancelled".format(handle))
+ self._logger.debug("Handle {} cancelled".format(handle))
else:
- #self._logger.debug("Calling handle {}".format(handle))
+ self._logger.debug("Calling handle {}".format(handle))
handle._run()
+ finally:
+ del self.__callbacks[timerid]
+ handle = None
self.killTimer(timerid)
def stop(self):
@@ -341,7 +343,10 @@ class _QEventLoop:
self._logger.debug(
'Registering callback {} to be invoked with arguments {} after {} second(s)'
.format(callback, args, delay))
- return self._timer.add_callback(asyncio.Handle(callback, args, self), delay)
+ return self._add_callback(asyncio.Handle(callback, args, self), delay)
+
+ def _add_callback(self, handle, delay=0):
+ return self._timer.add_callback(handle, delay)
def call_soon(self, callback, *args):
"""Register a callback to be run on the next iteration of the event loop."""
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/python-quamash.git
More information about the Pkg-bitcoin-commits
mailing list