Change in vdsm[master]: stomp: allow to mock monotonic_time method
fromani at redhat.com
fromani at redhat.com
Thu Jul 30 14:54:15 UTC 2015
Francesco Romani has posted comments on this change.
Change subject: stomp: allow to mock monotonic_time method
......................................................................
Patch Set 1:
(3 comments)
suggestion about alternate approach inside
https://gerrit.ovirt.org/#/c/43745/1/lib/yajsonrpc/stomp.py
File lib/yajsonrpc/stomp.py:
Line 322: There are two implementations available:
Line 323: - StompAdapterImpl - responsible for server side
Line 324: - AsyncClient - responsible for client side
Line 325: """
Line 326: def __init__(self, connection, frame_handler, bufferSize=4096):
another alternative is just to have
def __init__(self, connection, frame_handler, bufferSize=4096, clock=utils.monotinic_time):
self.connection = connection
self._frame_handler = frame_handler
self._bufferSize = buffersize
self._clock = clock
and later just use self._clock(), like for example...
Line 327: self._frame_handler = frame_handler
Line 328: self.connection = connection
Line 329: self._bufferSize = bufferSize
Line 330: self._parser = Parser()
Line 360: def popFrame(self):
Line 361: return self._parser.popFrame()
Line 362:
Line 363: def _update_outgoing_heartbeat(self):
Line 364: self._lastOutgoingTimeStamp = utils.monotonic_time()
...here:
self._lastOutgoingTimeStamp = self._clock()
Line 365:
Line 366: def _outgoing_heartbeat_expiration_interval(self):
Line 367: now = utils.monotonic_time()
Line 368: since_last_update = (now - self._lastOutgoingTimeStamp)
Line 363: def _update_outgoing_heartbeat(self):
Line 364: self._lastOutgoingTimeStamp = utils.monotonic_time()
Line 365:
Line 366: def _outgoing_heartbeat_expiration_interval(self):
Line 367: now = utils.monotonic_time()
...and here:
now = self._clock()
Line 368: since_last_update = (now - self._lastOutgoingTimeStamp)
Line 369: return (self._outgoing_heartbeat_in_milis / 1000.0) - since_last_update
Line 370:
Line 371: def next_check_interval(self):
--
To view, visit https://gerrit.ovirt.org/43745
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I59b65b12ddbcc547dc2bf45bf4dc3742a7778dea
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Dima Kuznetsov <dkuznets at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: Yeela Kaplan <ykaplan at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list