Skip to content

Commit

Permalink
The instantiation ctx timeout for postgres datastore is aggressive at…
Browse files Browse the repository at this point in the history
… 5 seconds.

This causes intermittent initialisation failures in environments where the postgres is slow / remote etc.
Since this is an instantiation flow, its ok to increase the timeout to a higher number like 30 seconds.
This can avoid such failures.
  • Loading branch information
anoopsundial committed Oct 19, 2024
1 parent 4262bfd commit ef38bec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/datastore/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func newPostgresDatastore(
Msg("postgres configured to use intermediate migration phase")
}

initializationContext, cancelInit := context.WithTimeout(context.Background(), 5*time.Second)
initializationContext, cancelInit := context.WithTimeout(context.Background(), 30*time.Second)
defer cancelInit()

readPool, err := pgxpool.NewWithConfig(initializationContext, readPoolConfig)
Expand Down

0 comments on commit ef38bec

Please sign in to comment.