rethinkdb-ts: Pool status - healthy never get updated?
If the server goes down after connected it seems like the connection count and health info isn’t updated. see comments inline in the code…
Having the same issue wiht rethinkdbdash (using latest versions)
example:
import { r, MasterPool } from 'rethinkdb-ts'
export class Server {
pool: MasterPool
public async connect() {
let options = {
host: 'localhost',
port: 28015,
db: 'catalog',
silent: false,
pingInterval: 1
}
// these are never called even though the server are taken down,
// or not started at program start but are made available later...
this.pool = await r.connectPool(options)
this.pool.on('error', (e) => {
console.log('error', e)
})
this.pool.on('size', (e) => {
console.log('size', e)
})
this.pool.on('available-size', (e) => {
console.log('available-size', e)
})
this.pool.on('healthy', (e) => {
console.log('healthy', e)
})
}
public check() {
setInterval(async () => {
// this will continue to print true, 1, 1 even if the server goes down...
console.log(this.pool.isHealthy)
console.log(this.pool.getAvailableLength())
console.log(this.pool.getLength())
/*
if (r.getPoolMaster()!.isHealthy) {
const result = await r
.table('PhoneCatalog')
.filter({ callsign: 'xxx' })
.run()
.catch(what => {
console.log('catch', what)
})
console.log(result)
}
*/
}, 1000 * 5)
}
}
let s = new Server()
s.connect()
s.check()
rethinkdbdash issue might be related: https://github.com/neumino/rethinkdbdash/issues/366
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18
Commits related to this issue
- Fixed issue #7 reconnect if connection lost — committed to rethinkdb/rethinkdb-ts by ronzeidman 6 years ago
############################ catch { ReqlDriverError: None of the pools have an opened connection and failed to open a new one. at MasterConnectionPool.queue (/Users/kjetil/dev/rethinkdb/rethinkdb-ts/lib/connection/master-pool.js:134:19) at Proxy.<anonymous> (/Users/kjetil/dev/rethinkdb/rethinkdb-ts/lib/query-builder/term-builder.js:77:67) at Server.<anonymous> (/Users/kjetil/dev/rethinkdb/rethinkdb-ts/my-test.js:92:34) at step (/Users/kjetil/dev/rethinkdb/rethinkdb-ts/my-test.js:32:23) at Object.next (/Users/kjetil/dev/rethinkdb/rethinkdb-ts/my-test.js:13:53) at /Users/kjetil/dev/rethinkdb/rethinkdb-ts/my-test.js:7:71 at new Promise (<anonymous>) at __awaiter (/Users/kjetil/dev/rethinkdb/rethinkdb-ts/my-test.js:3:12) at Timeout._onTimeout (/Users/kjetil/dev/rethinkdb/rethinkdb-ts/my-test.js:79:42) at ontimeout (timers.js:436:11) msg: ‘None of the pools have an opened connection and failed to open a new one.’, _type: 3, cause: undefined, name: ‘ReqlDriverError’, term: undefined, backtrace: undefined } ############################
Den ons. 14. nov. 2018 kl. 20:22 skrev Ron Zeidman <notifications@github.com