[serve] Add delete_backend call (#8252)

This commit is contained in:
Edward Oakes
2020-04-30 13:10:39 -05:00
committed by GitHub
parent c593fb09b7
commit 43be73e4cf
6 changed files with 141 additions and 23 deletions
+12
View File
@@ -269,6 +269,18 @@ class Router:
"backend {} to {}".format(backend, config_dict))
self.backend_info[backend] = config_dict
async def remove_backend(self, backend):
logger.debug("Removing backend {}".format(backend))
async with self.flush_lock:
await self._flush_service_queues()
await self._flush_buffer_queues()
if backend in self.backend_info:
del self.backend_info[backend]
if backend in self.worker_queues:
del self.worker_queues[backend]
if backend in self.buffer_queues:
del self.buffer_queues[backend]
async def flush(self):
"""In the default case, flush calls ._flush.