mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:27:42 +00:00
fix(setup): reenable index creation (#9868)
# Which Problems Are Solved
We saw high CPU usage if many events were created on the database. This
was caused by the new actions which query for all event types and
aggregate types.
# How the Problems Are Solved
- the handler of action execution does not filter for aggregate and
event types.
- the index for `instance_id` and `position` is reenabled.
# Additional Changes
none
# Additional Context
none
(cherry picked from commit 60ce32ca4f
)
This commit is contained in:
@@ -60,6 +60,7 @@ type Handler struct {
|
||||
requeueEvery time.Duration
|
||||
txDuration time.Duration
|
||||
now nowFunc
|
||||
queryGlobal bool
|
||||
|
||||
triggeredInstancesSync sync.Map
|
||||
|
||||
@@ -143,6 +144,11 @@ type Projection interface {
|
||||
Reducers() []AggregateReducer
|
||||
}
|
||||
|
||||
type GlobalProjection interface {
|
||||
Projection
|
||||
FilterGlobalEvents()
|
||||
}
|
||||
|
||||
func NewHandler(
|
||||
ctx context.Context,
|
||||
config *Config,
|
||||
@@ -185,6 +191,10 @@ func NewHandler(
|
||||
metrics: metrics,
|
||||
}
|
||||
|
||||
if _, ok := projection.(GlobalProjection); ok {
|
||||
handler.queryGlobal = true
|
||||
}
|
||||
|
||||
return handler
|
||||
}
|
||||
|
||||
@@ -676,6 +686,10 @@ func (h *Handler) eventQuery(currentState *state) *eventstore.SearchQueryBuilder
|
||||
}
|
||||
}
|
||||
|
||||
if h.queryGlobal {
|
||||
return builder
|
||||
}
|
||||
|
||||
aggregateTypes := make([]eventstore.AggregateType, 0, len(h.eventTypes))
|
||||
eventTypes := make([]eventstore.EventType, 0, len(h.eventTypes))
|
||||
|
||||
|
Reference in New Issue
Block a user