mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 00:17:32 +00:00
perf: query data AS OF SYSTEM TIME
(#5231)
Queries the data in the storage layser at the timestamp when the call hit the API layer
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/api/authz"
|
||||
"github.com/zitadel/zitadel/internal/api/call"
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/query/projection"
|
||||
@@ -73,7 +74,7 @@ func (q *Queries) NotificationProviderByIDAndType(ctx context.Context, aggID str
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
|
||||
query, scan := prepareDebugNotificationProviderQuery()
|
||||
query, scan := prepareDebugNotificationProviderQuery(ctx, q.client)
|
||||
stmt, args, err := query.Where(
|
||||
sq.And{
|
||||
sq.Eq{NotificationProviderColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()},
|
||||
@@ -93,7 +94,7 @@ func (q *Queries) NotificationProviderByIDAndType(ctx context.Context, aggID str
|
||||
return scan(row)
|
||||
}
|
||||
|
||||
func prepareDebugNotificationProviderQuery() (sq.SelectBuilder, func(*sql.Row) (*DebugNotificationProvider, error)) {
|
||||
func prepareDebugNotificationProviderQuery(ctx context.Context, db prepareDatabase) (sq.SelectBuilder, func(*sql.Row) (*DebugNotificationProvider, error)) {
|
||||
return sq.Select(
|
||||
NotificationProviderColumnAggID.identifier(),
|
||||
NotificationProviderColumnCreationDate.identifier(),
|
||||
@@ -103,7 +104,8 @@ func prepareDebugNotificationProviderQuery() (sq.SelectBuilder, func(*sql.Row) (
|
||||
NotificationProviderColumnState.identifier(),
|
||||
NotificationProviderColumnType.identifier(),
|
||||
NotificationProviderColumnCompact.identifier(),
|
||||
).From(notificationProviderTable.identifier()).PlaceholderFormat(sq.Dollar),
|
||||
).From(notificationProviderTable.identifier() + db.Timetravel(call.Took(ctx))).
|
||||
PlaceholderFormat(sq.Dollar),
|
||||
func(row *sql.Row) (*DebugNotificationProvider, error) {
|
||||
p := new(DebugNotificationProvider)
|
||||
err := row.Scan(
|
||||
|
Reference in New Issue
Block a user