Change in vdsm[master]: asyncore: Move generic reactor functionality

fromani at redhat.com fromani at redhat.com
Tue Mar 10 09:23:11 UTC 2015


Francesco Romani has posted comments on this change.

Change subject: asyncore: Move generic reactor functionality
......................................................................


Patch Set 10:

(3 comments)

possible improvements, -1 for visibility

https://gerrit.ovirt.org/#/c/37055/10/lib/yajsonrpc/betterAsyncore.py
File lib/yajsonrpc/betterAsyncore.py:

Line 132: 
Line 133:         asyncore.file_dispatcher.close(self)
Line 134: 
Line 135: 
Line 136: class Reactor(object):
nice. Some unit tests would make it even nicer :)
Line 137:     def __init__(self):
Line 138:         self._map = {}
Line 139:         self._isRunning = False
Line 140:         self._wakeupEvent = AsyncoreEvent(self._map)


Line 135: 
Line 136: class Reactor(object):
Line 137:     def __init__(self):
Line 138:         self._map = {}
Line 139:         self._isRunning = False
nit: should_we_use_pep8_names_here ?
Line 140:         self._wakeupEvent = AsyncoreEvent(self._map)
Line 141: 
Line 142:     def add_dispatcher(self, disp):
Line 143:         disp.add_channel(self._map)


Line 150:         while self._isRunning:
Line 151:             asyncore.loop(timeout=.5, use_poll=True, map=self._map, count=1)
Line 152: 
Line 153:         for key, dispatcher in self._map.items():
Line 154:             del self._map[key]
python3 warning: this will blow up as soon as we move to py3.

This should deliver the same result (written on the fly - untested)

  for dispatcher in self._map.values():
     dispatcher.close()
  
  self._map.clear()
Line 155:             dispatcher.close()
Line 156: 
Line 157:     def wakeup(self):
Line 158:         self._wakeupEvent.set()


-- 
To view, visit https://gerrit.ovirt.org/37055
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I59a14b18f4c08d873763e1d3bd9d42b99de05fb1
Gerrit-PatchSet: 10
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
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-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list