mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-06 17:22:28 +00:00
fix(projections): added check to make sure there cannot be 2 projections for the same table (#10439)
# Which Problems Are Solved
It should not be possible to start 2 projections with the same name.
If this happens, it can cause issues with the event store such as events
being skipped/unprocessed and can be very hard/time-consuming to
diagnose.
# How the Problems Are Solved
A check was added to make sure no 2 projections have the same table
Closes https://github.com/zitadel/zitadel/issues/10453
---------
Co-authored-by: Silvan <27845747+adlerhurst@users.noreply.github.com>
(cherry picked from commit 10bd747105)
This commit is contained in:
@@ -207,10 +207,18 @@ func Init(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Start(ctx context.Context) {
|
||||
func Start(ctx context.Context) error {
|
||||
projectionTableMap := make(map[string]bool, len(projections))
|
||||
for _, projection := range projections {
|
||||
table := projection.String()
|
||||
if projectionTableMap[table] {
|
||||
return fmt.Errorf("projeciton for %s already added", table)
|
||||
}
|
||||
projectionTableMap[table] = true
|
||||
|
||||
projection.Start(ctx)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ProjectInstance(ctx context.Context) error {
|
||||
|
||||
Reference in New Issue
Block a user