Any way to delay the need for a db on startup?

While attempting to dockerize my play application, I’m running into the problem that it is attempting to connect to the db configured in my application.conf before the db is ready to accept connections. There are workarounds in docker-compose compositioning, mainly by putting in a entry point to wait for the db before executing the play application entry point. But it seems that the play application should be less eager here. Is there a way to control this?

Hey @PeeDub,

You can emulate this behavior using initializationFailTimeout. From HikariCP docs:

This property controls whether the pool will “fail fast” if the pool cannot be seeded with an initial connection successfully. Any positive number is taken to be the number of milliseconds to attempt to acquire an initial connection; the application thread will be blocked during this period. If a connection cannot be acquired before this timeout occurs, an exception will be thrown. This timeout is applied after the connectionTimeout period. If the value is zero (0), HikariCP will attempt to obtain and validate a connection. If a connection is obtained, but fails validation, an exception will be thrown and the pool not started. However, if a connection cannot be obtained, the pool will start, but later efforts to obtain a connection may fail. A value less than zero will bypass any initial connection attempt, and the pool will start immediately while trying to obtain connections in the background. Consequently, later efforts to obtain a connection may fail. Default: 1