Changeset 463
- Timestamp:
- 09/29/07 17:52:54 (1 year ago)
- Files:
-
- ChangeLog (modified) (1 diff)
- buildbot/status/web/base.py (modified) (1 diff)
- buildbot/status/web/baseweb.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ChangeLog
r462 r463 1 1 2007-09-29 Brian Warner <warner@lothar.com> 2 3 * buildbot/status/web/base.py (HtmlResource.render): keep track of 4 HTTPChannels, so we can shut them down at reconfig time (when the 5 WebStatus goes away). Closes #102. 6 * buildbot/status/web/baseweb.py (WebStatus.__init__): same 7 (WebStatus.registerChannel): same 8 (WebStatus.stopService): do .loseConnection() here 2 9 3 10 * buildbot/test/test_webparts.py (Webparts.testPages): reload the buildbot/status/web/base.py
r452 r463 175 175 176 176 def render(self, request): 177 # tell the WebStatus about the HTTPChannel that got opened, so they 178 # can close it if we get reconfigured and the WebStatus goes away. 179 # They keep a weakref to this, since chances are good that it will be 180 # closed by the browser or by us before we get reconfigured. See 181 # ticket #102 for details. 182 if hasattr(request, "channel"): 183 # web.distrib.Request has no .channel 184 request.site.buildbot_service.registerChannel(request.channel) 177 185 178 186 # Our pages no longer require that their URL end in a slash. Instead, buildbot/status/web/baseweb.py
r462 r463 1 1 2 import os, sys, time, urllib 2 import os, sys, time, urllib, weakref 3 3 from itertools import count 4 4 … … 342 342 343 343 # we are not a ComparableMixin, and therefore the webserver will be 344 # rebuilt every time we reconfig. 344 # rebuilt every time we reconfig. This is because WebStatus.putChild() 345 # makes it too difficult to tell whether two instances are the same or 346 # not (we'd have to do a recursive traversal of all children to discover 347 # all the changes). 345 348 346 349 def __init__(self, http_port=None, distrib_port=None, allowForce=False): … … 410 413 self.template_values = {} 411 414 412 # TODO: browsers will cache connections, and if we've recently 413 # reloaded the config file, a browser might still be talking to the 414 # previous Site, which will work for some things, but will break when 415 # they try to reach through our .parent attribute (usually via 416 # HtmlResource.getStatus(), which does 417 # request.site.buildbot_service.parent). I don't know of a good way 418 # to deal with this.. maybe the Site has some list of current 419 # connections which we can crawl through and terminate? 415 # keep track of cached connections so we can break them when we shut 416 # down. See ticket #102 for more details. 417 self.channels = weakref.WeakKeyDictionary() 420 418 421 419 if self.http_port is not None: … … 470 468 """This behaves a lot like root.putChild() . """ 471 469 self.childrenToBeAdded[name] = child_resource 470 471 def registerChannel(self, channel): 472 self.channels[channel] = 1 # weakrefs 473 474 def stopService(self): 475 for channel in self.channels: 476 try: 477 channel.transport.loseConnection() 478 except: 479 log.msg("WebStatus.stopService: error while disconnecting" 480 " leftover clients") 481 log.err() 482 return service.MultiService.stopService(self) 472 483 473 484 def getStatus(self):
![[Buildbot Logo]](/trac/chrome/site/header-text-transparent.png)