mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-15 01:57:41 +00:00
fix(mirror): skip notification projections (#9878)
# Which Problems Are Solved During the mirror command execution we saw high wait times for notification projections. # How the Problems Are Solved As the events are skipped anyways because the notifications are sent out by the source Zitadel we skip the projections and just set the current state.
This commit is contained in:
@@ -59,6 +59,26 @@ func Start(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
func SetCurrentState(ctx context.Context, es *eventstore.Eventstore) error {
|
||||
if len(projections) == 0 {
|
||||
return nil
|
||||
}
|
||||
position, err := es.LatestSequence(ctx, eventstore.NewSearchQueryBuilder(eventstore.ColumnsMaxSequence).InstanceID(authz.GetInstance(ctx).InstanceID()).OrderDesc().Limit(1))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i, projection := range projections {
|
||||
logging.WithFields("name", projection.ProjectionName(), "instance", authz.GetInstance(ctx).InstanceID(), "index", fmt.Sprintf("%d/%d", i, len(projections))).Info("set current state of notification projection")
|
||||
_, err = projection.Trigger(ctx, handler.WithMinPosition(position))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
logging.WithFields("name", projection.ProjectionName(), "instance", authz.GetInstance(ctx).InstanceID(), "index", fmt.Sprintf("%d/%d", i, len(projections))).Info("current state of notification projection set")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ProjectInstance(ctx context.Context) error {
|
||||
for i, projection := range projections {
|
||||
logging.WithFields("name", projection.ProjectionName(), "instance", authz.GetInstance(ctx).InstanceID(), "index", fmt.Sprintf("%d/%d", i, len(projections))).Info("starting notification projection")
|
||||
|
Reference in New Issue
Block a user