Skip to content

Commit

Permalink
Fix: post-creating index concurrently
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Oct 10, 2023
1 parent 119dedc commit 1a707ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/indexer/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (bi *BlockchainIndexer) Index(ctx context.Context, head noderpc.Header) err

bi.indicesInit.Do(func() {
if err := bi.createIndices(ctx); err != nil {
log.Err(err).Msg("can't create index")
log.Err(err).Str("network", bi.Network.String()).Msg("can't create index")
}
})

Expand Down
1 change: 1 addition & 0 deletions internal/postgres/core/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
func (p *Postgres) CreateIndex(ctx context.Context, name, columns string, model any) error {
_, err := p.DB.NewCreateIndex().
Model(model).
Concurrently().
IfNotExists().
Index(name).
ColumnExpr(columns).
Expand Down

0 comments on commit 1a707ee

Please sign in to comment.