diff --git a/internal/eventstore/handler/v2/handler.go b/internal/eventstore/handler/v2/handler.go index 2f59aeed62..b9e9691e70 100644 --- a/internal/eventstore/handler/v2/handler.go +++ b/internal/eventstore/handler/v2/handler.go @@ -45,6 +45,7 @@ type Config struct { ActiveInstancer interface { ActiveInstances() []string } + SkipInstanceIDs []string } type Handler struct { @@ -70,6 +71,8 @@ type Handler struct { queryInstances func() ([]string, error) metrics *ProjectionMetrics + + skipInstanceIDs []string } var _ migration.Migration = (*Handler)(nil) @@ -188,7 +191,8 @@ func NewHandler( } return nil, nil }, - metrics: metrics, + metrics: metrics, + skipInstanceIDs: config.SkipInstanceIDs, } if _, ok := projection.(GlobalProjection); ok { @@ -420,6 +424,9 @@ func WithMinPosition(position decimal.Decimal) TriggerOpt { } func (h *Handler) Trigger(ctx context.Context, opts ...TriggerOpt) (_ context.Context, err error) { + if slices.Contains(h.skipInstanceIDs, authz.GetInstance(ctx).InstanceID()) { + return call.ResetTimestamp(ctx), nil + } config := new(triggerConfig) for _, opt := range opts { opt(config) diff --git a/internal/query/projection/config.go b/internal/query/projection/config.go index 085f5a60cf..70ffad0778 100644 --- a/internal/query/projection/config.go +++ b/internal/query/projection/config.go @@ -26,4 +26,5 @@ type CustomConfig struct { ConcurrentInstances *uint BulkLimit *uint16 TransactionDuration *time.Duration + SkipInstanceIDs []string } diff --git a/internal/query/projection/projection.go b/internal/query/projection/projection.go index e6f9c64b01..e89530bf0d 100644 --- a/internal/query/projection/projection.go +++ b/internal/query/projection/projection.go @@ -275,6 +275,7 @@ func applyCustomConfig(config handler.Config, customConfig CustomConfig) handler if customConfig.TransactionDuration != nil { config.TransactionDuration = *customConfig.TransactionDuration } + config.SkipInstanceIDs = append(config.SkipInstanceIDs, customConfig.SkipInstanceIDs...) return config }