fix: undo scan for current sequence in get by id (#1956)

* index on events for changes

* check for current sequence before filter events

* fix(migration): enable hash shared indexes feature

* fix(database): drop changes idx as it slows unwanted queries

* fix: remove check for current sequence after objects loaded as not all events are processed
This commit is contained in:
Silvan
2021-07-01 22:32:16 +02:00
committed by GitHub
parent d5626db71b
commit 992b598100
7 changed files with 13 additions and 70 deletions
@@ -38,13 +38,7 @@ func (repo *OrgRepo) OrgByID(ctx context.Context, id string) (*org_model.OrgView
org = new(model.OrgView)
}
sequence := org.Sequence
currentSequence, err := repo.View.GetLatestOrgSequence()
if err == nil {
sequence = currentSequence.CurrentSequence
}
events, esErr := repo.getOrgEvents(ctx, id, sequence)
events, esErr := repo.getOrgEvents(ctx, id, org.Sequence)
if errors.IsNotFound(viewErr) && len(events) == 0 {
return nil, errors.ThrowNotFound(nil, "EVENT-Lsoj7", "Errors.Org.NotFound")
}