def _gc(self):
"""Remove disconnected websocket handlers."""
for directory in self.handlers.keys():
handlers = [(pattern, handler, impl)
for pattern, handler, impl in self.handlers[directory]
if handler.active()]
_LOGGER.info('Number of active handlers for %s: %s',
directory, len(handlers))
if not handlers:
_LOGGER.info('No active handlers for %s', directory)
self.handlers.pop(directory, None)
if directory not in self.watch_dirs:
# Watch is not permanent, remove dir from watcher.
self.watcher.remove_dir(directory)
else:
self.handlers[directory] = handlers
评论列表
文章目录