Skip to content

Adding timeout to queries #6

Open

Description

@borgarlie

Hi,

We are currently trying out Terpal, and are wondering if there is a way to add timeout to queries?

E.g. kotlinquery supports a queryTimeout when generating sessions.

fun sessionOf(
    url: String,
    user: String,
    password: String,
    returnGeneratedKey: Boolean = false,
    strict: Boolean = false,
    queryTimeout: Int? = null
): Session

This is very useful, as we don't want to use the default database timeout for all our queries.

I have looked around briefly, but couldn't find anything obvious in Terpal so far.

Thanks!

Activity

  1. deusaquilus commented on Feb 16, 2025

    @deusaquilus
    Member

    Makes sense to have this configureable on a per-query basis. Let me figure out where to add it.

    (P.S. For faster replies, ping me on the Terpal channel on the Kotlin Slack)

  2. cies commented on Jun 14, 2025

    @cies

    I'm interested in this as well...

  3. deusaquilus commented on Jun 20, 2025

    @deusaquilus
    Member

    Have a look at the latest release where you can pass a JdbcExecutionOptions to the runOn functions. This has a sessionTimeout, fetchSize, and queryTimeout. It also has custom prepare-lambdas that it will call on Connection/PreparedStatement/ResultSet if you want even more fine-grained control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions