From d2b5ccc40d53420f149181d0e7a4f2c312c4fba1 Mon Sep 17 00:00:00 2001 From: bwolf200 Date: Tue, 20 Aug 2024 11:58:41 -0700 Subject: [PATCH] fix for potential race condition --- internal/pkg/tablemgr/routing_table_manager.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/pkg/tablemgr/routing_table_manager.go b/internal/pkg/tablemgr/routing_table_manager.go index 6a47347a..748c20d5 100644 --- a/internal/pkg/tablemgr/routing_table_manager.go +++ b/internal/pkg/tablemgr/routing_table_manager.go @@ -217,7 +217,9 @@ func (r *DefaultRoutingTableManager) RemoveRoute(ctx context.Context, tid tenant } func (r *DefaultRoutingTableManager) RouteEvent(ctx context.Context, tid tenant.Id, routeId string, payload interface{}) (*event.Event, string, error) { + r.Lock() lrw, ok := r.liveRouteMap[tid.KeyWithRoute(routeId)] + r.Unlock() if !ok { return nil, "", errors.New("no route " + routeId) }