mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-16 10:45:12 +00:00
fix(query): realtime data on defined requests (#3726)
* feat: directly specify factors on addCustomLoginPolicy and return on LoginPolicy responses * fix proto * update login policy * feat: directly specify idp on addCustomLoginPolicy and return on LoginPolicy responses * fix: tests * fix(projection): trigger bulk * refactor: clean projection pkg * instance should bulk * fix(query): should trigger bulk on id calls * tests * build prerelease * fix: add shouldTriggerBulk * fix: test Co-authored-by: Livio Amstutz <[email protected]> Co-authored-by: Max Peintner <[email protected]>
This commit is contained in:
co-authored by
Livio Amstutz
Max Peintner
parent
5c805c48db
commit
dd2f31683c
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/handler"
|
||||
"github.com/zitadel/zitadel/internal/telemetry/tracing"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -62,7 +63,6 @@ func NewStatementHandler(
|
||||
}
|
||||
|
||||
h := StatementHandler{
|
||||
ProjectionHandler: handler.NewProjectionHandler(config.ProjectionHandlerConfig),
|
||||
client: config.Client,
|
||||
sequenceTable: config.SequenceTable,
|
||||
maxFailureCount: config.MaxFailureCount,
|
||||
@@ -75,11 +75,12 @@ func NewStatementHandler(
|
||||
bulkLimit: config.BulkLimit,
|
||||
Locker: NewLocker(config.Client, config.LockTable, config.ProjectionHandlerConfig.ProjectionName),
|
||||
}
|
||||
h.ProjectionHandler = handler.NewProjectionHandler(config.ProjectionHandlerConfig, h.reduce, h.Update, h.SearchQuery)
|
||||
|
||||
err := h.Init(ctx, config.InitCheck)
|
||||
logging.OnError(err).Fatal("unable to initialize projections")
|
||||
|
||||
go h.ProjectionHandler.Process(
|
||||
go h.Process(
|
||||
ctx,
|
||||
h.reduce,
|
||||
h.Update,
|
||||
@@ -88,11 +89,20 @@ func NewStatementHandler(
|
||||
h.SearchQuery,
|
||||
)
|
||||
|
||||
h.ProjectionHandler.Handler.Subscribe(h.aggregates...)
|
||||
h.Subscribe(h.aggregates...)
|
||||
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *StatementHandler) TriggerBulk(ctx context.Context) {
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
var err error
|
||||
defer span.EndWithError(err)
|
||||
|
||||
err = h.ProjectionHandler.TriggerBulk(ctx, h.Lock, h.Unlock)
|
||||
logging.OnError(err).WithField("projection", h.ProjectionName).Warn("unable to trigger bulk")
|
||||
}
|
||||
|
||||
func (h *StatementHandler) SearchQuery(ctx context.Context) (*eventstore.SearchQueryBuilder, uint64, error) {
|
||||
sequences, err := h.currentSequences(ctx, h.client.QueryContext)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user