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

Introduce AbortSignal to Driver.executeQuery #1199

Merged
merged 6 commits into from
Jun 18, 2024

Conversation

bigmontz
Copy link
Contributor

@bigmontz bigmontz commented Jun 17, 2024

⚠️ This API is released as preview.
This configuration property enables the cancellation of ongoing queries which was previous not possible when using Driver.executeQuery.

The cancellation is done by closing the session used internally by the driver when execute the query. This means the cancellation is not safe and transaction might be commit apart of the execution being aborted. The cancellation might also triggers errors on the Driver.executeQuery execution.

Example:

const abortController = new AbortController()

// Some event which cancels the query
process.on('SIGINT', () => abortController.abort() )

const result = await driver.executeQuery(query, params, {
    database: 'neo4j',
    signal: abortController.signal
})

⚠️ This API is released as preview.

**⚠️ This API is released as preview.**
This configuration property enables the cancellation of ongoing
queries which was previous not possible when using `Driver.executeQuery`.

The cancellation is done by closing the session used internally by
the driver when execute the query.
This means the cancellation is not safe and transaction might be
commit apart of the execution be aborted.
The cancellation might also triggers errors on the `Driver.executeQuery`
execution.

Example:

```javascript
const abortController = new AbortController()

// Some event which cancels the query
process.on('SIGINT', () => abortController.abort() )

const result = await driver.executeQuery(query, params, {
    database: 'neo4j',
    signal: abortController.signal
})
```

**⚠️ This API is released as preview.**
packages/core/src/driver.ts Outdated Show resolved Hide resolved
bigmontz and others added 2 commits June 18, 2024 10:13
Co-authored-by: gjmwoods <42248895+gjmwoods@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants