fix: improve startup times by initializing projection tables during setup (#4642)

* fix: improve startup times by initializing projections table during setup

* add missing file
This commit is contained in:
Livio Spring
2022-11-04 10:21:58 +01:00
committed by GitHub
parent e15e733cc3
commit c791f6de58
12 changed files with 285 additions and 66 deletions

View File

@@ -687,6 +687,25 @@ func TestProjection_schedule(t *testing.T) {
},
want{},
},
{
"filter succeeded once error",
args{
ctx: context.Background(),
},
fields{
eventstore: func(t *testing.T) *eventstore.Eventstore {
return eventstore.NewEventstore(
es_repo_mock.NewRepo(t).ExpectFilterEventsError(ErrFilter),
)
},
triggerProjection: time.NewTimer(0),
},
want{
locksCount: 0,
lockCanceled: false,
unlockCount: 0,
},
},
{
"filter instance ids error",
args{
@@ -695,7 +714,15 @@ func TestProjection_schedule(t *testing.T) {
fields{
eventstore: func(t *testing.T) *eventstore.Eventstore {
return eventstore.NewEventstore(
es_repo_mock.NewRepo(t).ExpectInstanceIDsError(ErrFilter),
es_repo_mock.NewRepo(t).ExpectFilterEvents(
&repository.Event{
AggregateType: "system",
Sequence: 6,
PreviousAggregateSequence: 5,
InstanceID: "",
Type: "system.projections.scheduler.succeeded",
}).
ExpectInstanceIDsError(ErrFilter),
)
},
triggerProjection: time.NewTimer(0),
@@ -714,7 +741,14 @@ func TestProjection_schedule(t *testing.T) {
fields{
eventstore: func(t *testing.T) *eventstore.Eventstore {
return eventstore.NewEventstore(
es_repo_mock.NewRepo(t).ExpectInstanceIDs("instanceID1"),
es_repo_mock.NewRepo(t).ExpectFilterEvents(
&repository.Event{
AggregateType: "system",
Sequence: 6,
PreviousAggregateSequence: 5,
InstanceID: "",
Type: "system.projections.scheduler.succeeded",
}).ExpectInstanceIDs("instanceID1"),
)
},
triggerProjection: time.NewTimer(0),
@@ -738,7 +772,14 @@ func TestProjection_schedule(t *testing.T) {
fields{
eventstore: func(t *testing.T) *eventstore.Eventstore {
return eventstore.NewEventstore(
es_repo_mock.NewRepo(t).ExpectInstanceIDs("instanceID1"),
es_repo_mock.NewRepo(t).ExpectFilterEvents(
&repository.Event{
AggregateType: "system",
Sequence: 6,
PreviousAggregateSequence: 5,
InstanceID: "",
Type: "system.projections.scheduler.succeeded",
}).ExpectInstanceIDs("instanceID1"),
)
},
triggerProjection: time.NewTimer(0),