How to set a timeout to the database connection in SORM?

109 Views Asked by At

I use H2 database in embedded mode with SORM. If the database is busy then SORM just continue to wait. There are no exception, nothing happens. This is misleading. :( So how i can set the db connection timeout?

1

There are 1 best solutions below

2
On BEST ANSWER

How come it's misleading and how come exceptions are better? If you need the process to be non-blocking just use Future like so:

future{ Db.query[Artist].fetch() }.foreach{ artists => ... }

Consider this to be a non-blocking version of the following:

val artists = Db.query[Artist].fetch()