Changeset 5693
- Timestamp:
- 11/17/08 11:08:46 (2 months ago)
- Files:
-
- branches/1.1/turbogears/visit/api.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/turbogears/visit/api.py
r5495 r5693 141 141 if not hasattr(cherrypy.root, "_cp_filters"): 142 142 cherrypy.root._cp_filters = list() 143 cherrypy.root._cp_filters.append(visit_filter) 143 if not visit_filter in cherrypy.root._cp_filters: 144 cherrypy.root._cp_filters.append(visit_filter) 144 145 145 146 def shutdown_extension(): … … 297 298 self.lock = threading.Lock() 298 299 self._shutdown = threading.Event() 299 self.interval = 30 300 self.setDaemon(True) 300 self.interval = 30.0 301 301 # We need to create the visit model before the manager thread is 302 302 # started. 303 303 self.create_model() 304 self.setDaemon(True) 304 305 self.start() 305 306 … … 331 332 332 333 def shutdown(self, timeout=None): 333 self._shutdown.set() 334 self.join(timeout) 334 try: 335 self.lock.acquire() 336 self._shutdown.set() 337 self.join(timeout) 338 finally: 339 self.lock.release() 335 340 if self.isAlive(): 336 341 log.error("Visit Manager thread failed to shutdown.") … … 339 344 while not self._shutdown.isSet(): 340 345 self.lock.acquire() 346 if self._shutdown.isSet(): 347 continue 341 348 queue = None 342 349 try: … … 345 352 queue = self.queue.copy() 346 353 self.queue.clear() 354 if queue is not None: 355 self.update_queued_visits(queue) 347 356 finally: 348 357 self.lock.release() 349 if queue is not None:350 self.update_queued_visits(queue)351 358 self._shutdown.wait(self.interval)