Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transient Error Retries #283

Closed
JonathanHopeDMRC opened this issue Jan 17, 2023 · 2 comments
Closed

Transient Error Retries #283

JonathanHopeDMRC opened this issue Jan 17, 2023 · 2 comments
Labels
api Related to library's API built-in dialect Related to a built-in dialect enhancement New feature or request wontfix This will not be worked on

Comments

@JonathanHopeDMRC
Copy link

Some other NPM packages that have similar aims like Slonik support retrying transactions/queries. I can't find anything about retries in the kysely docs. Is there any plan to add support for retries to kysely, or is there a recommended approach using third party packages?

Thanks!

@igalklebanov igalklebanov added enhancement New feature or request api Related to library's API labels Jan 17, 2023
@igalklebanov
Copy link
Member

igalklebanov commented Jan 22, 2023

Hey 👋

Some other NPM packages that have similar aims like Slonik support retrying transactions/queries.

Slonik's aim seems to be node-postgres on steroids with some type-safety.
Kysely's aim is primarily to be a type-safe sql query builder. It also does other things like execution, migrations, etc.

I can't find anything about retries in the kysely docs. Is there any plan to add support for retries to kysely

Not that I know of. Thanks for submitting this issue.
There is some intent to provide more fine-grained control with transactions @ #257, that might make it easier for consumers to implement their own retry mechanisms.

is there a recommended approach using third party packages?

I'd probably try this library.

For query retries, I'd write a custom driver that extends a built-in driver and overrides query execution like:

async override executeQuery<O>(compiledQuery: CompiledQuery): Promise<QueryResult<O>> {
  try {
    return await backoff(() => super.executeQuery(compiledQuery));
  } catch (error: unknown) {
    // ...
  }
}

@igalklebanov igalklebanov added the built-in dialect Related to a built-in dialect label Jan 22, 2023
@koskimas
Copy link
Member

koskimas commented Jan 24, 2023

I think this is a little out of scope for a query builder. As @igalklebanov mentioned, a custom wrapper for your dialect is only some tens of lines of code and would suit well in this situation.

@igalklebanov igalklebanov added the wontfix This will not be worked on label Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to library's API built-in dialect Related to a built-in dialect enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants