From b2582c09920036e17627079a63c6ececae01a4be Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Sun, 9 Aug 2020 19:39:21 +0100 Subject: [PATCH] fix deadlock bug --- router/registry/table.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/router/registry/table.go b/router/registry/table.go index d695604a..e62fa915 100644 --- a/router/registry/table.go +++ b/router/registry/table.go @@ -61,6 +61,7 @@ func (t *table) pruneRoutes(olderThan time.Duration) { // deleteService removes the entire service func (t *table) deleteService(service, network string) { t.Lock() + defer t.Unlock() routes, ok := t.routes[service] if !ok { @@ -86,8 +87,6 @@ func (t *table) deleteService(service, network string) { // save the routes t.routes[service] = routes - - t.Unlock() } // saveRoutes completely replaces the routes for a service