node-influx icon indicating copy to clipboard operation
node-influx copied to clipboard

Can't abort query

Open frederikheld opened this issue 4 years ago • 0 comments

Expected Behavior

There should be a way to abort a running query, either by passing an integer in milliseconds as timeout or an AbortController (like it can be done with fetch) into the query function.

Example with fetch:

const abortController = new AbortController()
const abortTimeout = setTimeout(() => {
  abortController.abort()
}, 10000)

await fetch('<url>', {
  options: { /* options */ },
  signal: abortController.signal
})
clearTimeout(abortTimeout)

Actual Behavior

If the server isn't available or the network is bad, the query just takes forever.

Steps/Code to Reproduce the Problem

  1. use a wrong server address
  2. then start a query
const Influx = require('influx')
const influx = new Influx.InfluxDB(/* connection data with wrong address */)
const result = await influx.query(/* query */)
console.log('this line will never be executed')

Specifications

  • Version: 5.6.0
  • Platform: ?
  • Subsystem: ?

frederikheld avatar Dec 03 '21 00:12 frederikheld