feat: save last occurrence of failed events and fix instance filtering (#4710)

* fix: filter failed events and current sequence correctly

* fix failed events sorting column

* feat: save last occurrence of failed event

* fix failedEvents query and update sql statements

* change sql statement to only create index

* fix linting

* fix linting

* Update internal/query/failed_events.go

Co-authored-by: Silvan <silvan.reusser@gmail.com>

* update job name on test-docs to match the one from test-code

Co-authored-by: Silvan <silvan.reusser@gmail.com>
This commit is contained in:
Livio Spring
2022-11-18 13:49:38 +01:00
committed by GitHub
parent 6d787bfd62
commit 29441ce4b6
41 changed files with 291 additions and 90 deletions

View File

@@ -135,7 +135,7 @@ func (s *spooledHandler) awaitError(cancel func(), errs chan error, workerID str
select {
case err := <-errs:
cancel()
logging.Log("SPOOL-OT8di").OnError(err).WithField("view", s.ViewModel()).WithField("worker", workerID).Debug("load canceled")
logging.OnError(err).WithField("view", s.ViewModel()).WithField("worker", workerID).Debug("load canceled")
}
}
@@ -216,6 +216,7 @@ func HandleError(event *models.Event, failedErr error,
failedEvent.FailureCount++
failedEvent.ErrMsg = failedErr.Error()
failedEvent.InstanceID = event.InstanceID
failedEvent.LastFailed = time.Now()
err = processFailedEvent(failedEvent)
if err != nil {
return err

View File

@@ -17,6 +17,10 @@ import (
"github.com/zitadel/zitadel/internal/view/repository"
)
var (
testNow = time.Now()
)
type testHandler struct {
cycleDuration time.Duration
processSleep time.Duration
@@ -429,6 +433,7 @@ func TestHandleError(t *testing.T) {
FailureCount: 6,
ViewName: "super.table",
InstanceID: instanceID,
LastFailed: testNow,
}, nil
},
errorCountUntilSkip: 5,
@@ -449,6 +454,7 @@ func TestHandleError(t *testing.T) {
FailureCount: 5,
ViewName: "super.table",
InstanceID: instanceID,
LastFailed: testNow,
}, nil
},
errorCountUntilSkip: 6,
@@ -469,6 +475,7 @@ func TestHandleError(t *testing.T) {
FailureCount: 3,
ViewName: "super.table",
InstanceID: instanceID,
LastFailed: testNow,
}, nil
},
errorCountUntilSkip: 5,