fix: Synchronously notify subscribers when writing Create events to CDK backend (#110476)

* Remove goroutine when writing events on CDK backend

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

---------

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
This commit is contained in:
maicon
2025-09-03 11:49:04 -03:00
committed by GitHub
parent 9b18987df1
commit fa20755d4b
+10 -12
View File
@@ -146,19 +146,17 @@ func (s *cdkBackend) WriteEvent(ctx context.Context, event WriteEvent) (rv int64
})
}
// Async notify all subscribers
// notify all subscribers
if s.stream != nil {
go func() {
write := &WrittenEvent{
Type: event.Type,
Key: event.Key,
PreviousRV: event.PreviousRV,
Value: event.Value,
Timestamp: time.Now().UnixMilli(),
ResourceVersion: rv,
}
s.stream <- write
}()
write := &WrittenEvent{
Type: event.Type,
Key: event.Key,
PreviousRV: event.PreviousRV,
Value: event.Value,
Timestamp: time.Now().UnixMilli(),
ResourceVersion: rv,
}
s.stream <- write
}
return rv, err
}