Skip to content

Commit

Permalink
Allow cancellation of tiledb queries (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
SarantopoulosKon authored Sep 6, 2023
1 parent fe56fd1 commit 6868e9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/TileDBQuery/TileDBQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export class TileDBQuery {
undefined,
undefined,
{
cancelToken: options.cancelToken,
headers: {
'Content-Type': 'application/capnp'
},
Expand Down Expand Up @@ -210,7 +211,8 @@ export class TileDBQuery {
ignoreOffsets: body.ignoreOffsets,
attributes: body.attributes,
returnOffsets: body.returnOffsets,
returnRawBuffers: body.returnRawBuffers
returnRawBuffers: body.returnRawBuffers,
cancelToken: body.cancelToken
};
/**
* Get the query response in capnp, we set responseType to arraybuffer instead of JSON
Expand All @@ -227,6 +229,7 @@ export class TileDBQuery {
undefined,
undefined,
{
cancelToken: body.cancelToken,
headers: {
'Content-Type': 'application/capnp'
},
Expand Down
5 changes: 5 additions & 0 deletions src/utils/getResultsFromArrayBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import setNullables from './setNullables';
import groupValuesByOffsetBytes from './groupValuesByOffsetBytes';
import concatChars from './concatChars';
import convertToArray from './convertToArray';
import { CancelToken } from 'axios';

export interface Options {
/**
Expand All @@ -31,6 +32,10 @@ export interface Options {
* Return offsets for every var-length attribute
*/
returnOffsets?: boolean;
/**
* CancelToken
*/
cancelToken?: CancelToken;
}

type Result =
Expand Down

0 comments on commit 6868e9f

Please sign in to comment.