fix: always update the timestamp in trigger (#6326)

* always reset timestamp

* re-enable test

(cherry picked from commit 3c7b603650)
This commit is contained in:
Tim Möhlmann
2023-08-04 19:17:16 +03:00
committed by Livio Spring
parent 27513b7bfd
commit 61742139e0
2 changed files with 13 additions and 5 deletions

View File

@@ -140,8 +140,11 @@ func (h *ProjectionHandler) Trigger(ctx context.Context, instances ...string) co
// by calling FetchEvents and Process until the amount of events is smaller than the BulkLimit.
// If a bulk action was executed, the call timestamp in context will be reset for subsequent queries.
// The returned context is never nil. It is either the original context or an updated context.
func (h *ProjectionHandler) TriggerErr(ctx context.Context, instances ...string) (context.Context, error) {
func (h *ProjectionHandler) TriggerErr(ctx context.Context, instances ...string) (outCtx context.Context, err error) {
instances = triggerInstances(ctx, instances)
defer func() {
outCtx = call.ResetTimestamp(ctx)
}()
for {
events, hasLimitExceeded, err := h.FetchEvents(ctx, instances...)
if err != nil {
@@ -151,7 +154,6 @@ func (h *ProjectionHandler) TriggerErr(ctx context.Context, instances ...string)
return ctx, nil
}
_, err = h.Process(ctx, events...)
ctx = call.ResetTimestamp(ctx)
if err != nil {
return ctx, err
}