Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 9f9e048

Browse files
authored
fix: wait for db lock (#31)
1 parent 980d6b5 commit 9f9e048

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

main.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,16 @@ func main() {
5656

5757
go health.StartHealthEndpoint(cfg.Observability.HealthPort)
5858

59-
db, err := lvldb.NewLvlDB(cfg.Store.Path)
60-
if err != nil {
61-
panic(err)
59+
var db *lvldb.LVLDB
60+
for {
61+
db, err = lvldb.NewLvlDB(cfg.Store.Path)
62+
if err != nil {
63+
log.Error().Err(err).Msg("Unable to connect to blockstore file, retry in 10 seconds")
64+
time.Sleep(10 * time.Second)
65+
} else {
66+
log.Info().Msg("Successfully connected to blockstore file")
67+
break
68+
}
6269
}
6370
periodStore := store.NewPeriodStore(db)
6471

0 commit comments

Comments
 (0)