Skip to content

Commit 1aa659c

Browse files
authored
Fix: drop sqlite inmemory DB (#2002)
Unfortunately it seems that min_connections is not sufficient to prevent dropping the inmemory sqlite DB reliably. Therefore we override the idle_timeout and max_lifetime.
1 parent d55b144 commit 1aa659c

File tree

1 file changed

+6
-1
lines changed
  • rust/src/container_image_scanner/config

1 file changed

+6
-1
lines changed

rust/src/container_image_scanner/config/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,12 @@ impl SqliteConfiguration {
159159
.synchronous(SqliteSynchronous::Off)
160160
.create_if_missing(true);
161161
PoolOptions::<Sqlite>::new()
162-
.min_connections(1) // otherwise it may drop in-memory db
162+
// To prevent losing a in-memory DB we have to override max_lifetime and idle_timeout.
163+
// It seems that min_connections is not reliable enough for now to ensure at least one
164+
// connection being open.
165+
.max_lifetime(None)
166+
.idle_timeout(None)
167+
// To prevent exhausting of the DB we limit the connections.
163168
.max_connections(self.max_connections)
164169
.connect_with(options)
165170
.await

0 commit comments

Comments
 (0)