Explorar el Código

fix(cert): assignment to entry in nil map

Jacky hace 1 día
padre
commit
710b9f781e
Se han modificado 1 ficheros con 2 adiciones y 6 borrados
  1. 2 6
      internal/cert/mutex.go

+ 2 - 6
internal/cert/mutex.go

@@ -10,10 +10,10 @@ var (
 	mutex sync.Mutex
 	mutex sync.Mutex
 
 
 	// statusChan is the channel to broadcast certificate status changes
 	// statusChan is the channel to broadcast certificate status changes
-	statusChan chan bool
+	statusChan = make(chan bool, 10)
 
 
 	// subscribers is a map of channels that are subscribed to certificate status changes
 	// subscribers is a map of channels that are subscribed to certificate status changes
-	subscribers map[chan bool]struct{}
+	subscribers = make(map[chan bool]struct{})
 
 
 	// subscriberMux protects the subscribers map from concurrent access
 	// subscriberMux protects the subscribers map from concurrent access
 	subscriberMux sync.RWMutex
 	subscriberMux sync.RWMutex
@@ -26,10 +26,6 @@ var (
 )
 )
 
 
 func initBroadcastStatus(ctx context.Context) {
 func initBroadcastStatus(ctx context.Context) {
-	// Initialize channels and maps
-	statusChan = make(chan bool, 10) // Buffer to prevent blocking
-	subscribers = make(map[chan bool]struct{})
-
 	// Start broadcasting goroutine
 	// Start broadcasting goroutine
 	go broadcastStatus(ctx)
 	go broadcastStatus(ctx)
 }
 }