mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 14:47:33 +00:00
fixup! fix(projections): added check to make sure there cannot be 2 projections for the same table
This commit is contained in:
@@ -209,17 +209,18 @@ func Init(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Start(ctx context.Context) {
|
func Start(ctx context.Context) error {
|
||||||
projectionTableMap := make(map[string]bool, len(projections))
|
projectionTableMap := make(map[string]bool, len(projections))
|
||||||
for _, projection := range projections {
|
for _, projection := range projections {
|
||||||
table := projection.String()
|
table := projection.String()
|
||||||
if projectionTableMap[table] {
|
if projectionTableMap[table] {
|
||||||
panic("projeciton for " + projection.String() + " already added")
|
return fmt.Errorf("projeciton for %s already added", table)
|
||||||
}
|
}
|
||||||
projectionTableMap[table] = true
|
projectionTableMap[table] = true
|
||||||
|
|
||||||
projection.Start(ctx)
|
projection.Start(ctx)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ProjectInstance(ctx context.Context) error {
|
func ProjectInstance(ctx context.Context) error {
|
||||||
|
@@ -90,7 +90,10 @@ func StartQueries(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if startProjections {
|
if startProjections {
|
||||||
projection.Start(ctx)
|
err = projection.Start(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repo.caches, err = startCaches(
|
repo.caches, err = startCaches(
|
||||||
|
Reference in New Issue
Block a user