[Modeling-cvs] ProjectModeling/Modeling GlobalID.py,1.7,1.8
Status: Abandoned
Brought to you by:
sbigaret
From: <sbi...@us...> - 2003-09-13 13:01:05
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv23010/Modeling Modified Files: GlobalID.py Log Message: Fixed bug #804756: EditingContext.insertObject() appeared to be really slow when resolving dns entries is slow. Hence TemporaryGlobalID is now caching the FQDN on a per-session basis. Index: GlobalID.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/GlobalID.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GlobalID.py 14 Mar 2003 11:40:08 -0000 1.7 --- GlobalID.py 13 Sep 2003 13:01:02 -0000 1.8 *************** *** 205,209 **** lock=TemporaryGlobalIDIndex_lock.acquire unlock=TemporaryGlobalIDIndex_lock.release ! def __nextTemporaryIndex__(): "This is part of the initialization process of TemporaryGlobalID" lock() --- 205,209 ---- lock=TemporaryGlobalIDIndex_lock.acquire unlock=TemporaryGlobalIDIndex_lock.release ! def nextTemporaryIndex(): "This is part of the initialization process of TemporaryGlobalID" lock() *************** *** 230,240 **** __implements__=(ITemporaryGlobalID,) __is_temporary__=1 def __init__(self, *args, **kw): "Initializes a new TemporaryGlobalID. Arguments are currently ignored." ! self.__dict__['_host']=socket.getfqdn() ! self.__dict__['_index']=__nextTemporaryIndex__() ! hostname, aliaslist, ipaddrlist=socket.gethostbyname_ex(self._host) ! self.__dict__['_ip']=self.nonLocalIPIfAvailable(ipaddrlist) self.__dict__['_time']=time.strftime("%Y%m%d%H%M%S") self.__dict__['_TemporaryGlobalID__hash']=hash("%s/%s/%s/%s"%(self._index,self._time, self._host,self._ip)) --- 230,244 ---- __implements__=(ITemporaryGlobalID,) __is_temporary__=1 + + # We now cache the fqdn (_host) and ipaddrlist: when an host has problems + # resolving dns entries this can hang a few seconds, and + # EditingContext.insert() then appears to be really slow (bug #804756) + _host=socket.getfqdn() + _ipaddrlist=socket.gethostbyname_ex(_host)[2] def __init__(self, *args, **kw): "Initializes a new TemporaryGlobalID. Arguments are currently ignored." ! self.__dict__['_index']=nextTemporaryIndex() ! self.__dict__['_ip']=self.nonLocalIPIfAvailable(self._ipaddrlist) self.__dict__['_time']=time.strftime("%Y%m%d%H%M%S") self.__dict__['_TemporaryGlobalID__hash']=hash("%s/%s/%s/%s"%(self._index,self._time, self._host,self._ip)) |