Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: context

sidwebworksf78556c85fc8
diff --git a/k8-operator/config/crd/bases/secrets.infisical.com_infisicalsecrets.yaml b/k8-operator/config/crd/bases/secrets.infisical.com_infisicalsecrets.yaml
index 350dcf891b..0dcc39f17c 100644
--- a/k8-operator/config/crd/bases/secrets.infisical.com_infisicalsecrets.yaml
+++ b/k8-operator/config/crd/bases/secrets.infisical.com_infisicalsecrets.yaml
@@ -315,7 +315,7 @@ spec:
description: Infisical host to pull secrets from
type: string
instantUpdates:
- default: true
+ default: false
type: boolean
managedKubeConfigMapReferences:
items:
diff --git a/k8-operator/internal/util/sse/sse.go b/k8-operator/internal/util/sse/sse.go
index 062aafb57b..90918e8eaa 100644
--- a/k8-operator/internal/util/sse/sse.go
+++ b/k8-operator/internal/util/sse/sse.go
@@ -39,7 +39,6 @@ func (c *ConnectionMeta) Cancel() {
// ConnectionRegistry manages SSE connections with high performance
type ConnectionRegistry struct {
- ctx context.Context
client Client
mu sync.RWMutex
@@ -52,7 +51,6 @@ type ConnectionRegistry struct {
// NewConnectionRegistry creates a new high-performance connection registry
func NewConnectionRegistry(ctx context.Context) *ConnectionRegistry {
r := &ConnectionRegistry{
- ctx: ctx,
monitorStop: make(chan struct{}),
}
@@ -148,7 +146,7 @@ func (r *ConnectionRegistry) getConnection() *ConnectionMeta {
// createConnection creates a new SSE connection
func (r *ConnectionRegistry) createConnection(req *http.Request) (*ConnectionMeta, error) {
- ctx, cancel := context.WithCancel(r.ctx)
+ ctx, cancel := context.WithCancel(context.Background())
eventChan, errorChan, err := r.client.Connect(ctx, req)
if err != nil {
@@ -180,8 +178,6 @@ func (r *ConnectionRegistry) monitorConnections() {
select {
case <-r.monitorStop:
return
- case <-r.ctx.Done():
- return
case <-ticker.C:
r.checkConnectionHealth(pingTimeout)
}
@@ -200,6 +196,7 @@ func (r *ConnectionRegistry) checkConnectionHealth(timeout time.Duration) {
r.mu.Lock()
if r.conn == conn { // Verify it's still the same connection
r.conn.Cancel()
+ r.monitorStop <- struct{}{}
r.conn = nil
}
r.mu.Unlock()