Skip to content

Commit

Permalink
feat: queryTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Sciator committed Nov 10, 2023
1 parent c4bef5f commit 41f1b8e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
## 0.5.0 [unreleased]
## 0.4.1 [unreleased]

### Feature

1. Query timeout

### Bugfix

1. [#164](https://github.com/InfluxCommunity/influxdb3-js/issues/164): Default query timeout

## 0.4.0 [2023-11-03]

Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/impl/QueryApiImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export default class QueryApiImpl implements QueryApi {

const token = this._options.token
if (token) meta['authorization'] = `Bearer ${token}`

const options: RpcOptions = {meta}
const timeout = this._options.queryTimeout
const options: RpcOptions = {meta, timeout}

const flightDataStream = client.doGet(ticket, options)

Expand Down
6 changes: 6 additions & 0 deletions packages/client/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export interface ConnectionOptions {
* @defaultValue 10000
*/
timeout?: number
/**
* stream timeout for query (grpc timeout)
* @defaultValue 60000
*/
queryTimeout?: number
/**
* default database for write query if not present as argument.
*/
Expand Down Expand Up @@ -43,6 +48,7 @@ export interface ConnectionOptions {
/** default connection options */
export const DEFAULT_ConnectionOptions: Partial<ConnectionOptions> = {
timeout: 10000,
queryTimeout: 60000,
}

/**
Expand Down

0 comments on commit 41f1b8e

Please sign in to comment.