Reputation: 569
I have a play-scala application which uses slick-hikaricp. I know there is way to set connection timeout but I would like to set a query timeout. I have some slow queries and if they take more than 3 seconds I would like to stop them with timeout setting. I searched and bonecp provides a parameter named as 'queryExecuteTimeLimit' but I couldn't find a setting for hikaricp. Do you know how can I set a query timeout?
Upvotes: 2
Views: 1935
Reputation: 48410
Have you tried using Slick's withStatementParameters
to setQueryTimeout
? For example,
myTable.result.withStatementParameters(statementInit = _.setQueryTimeout(3))
This should throw SQLTimeoutException
if query takes longer than 3 seconds.
Upvotes: 5