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

What happens on connection error ? #41

Open
atassis opened this issue Dec 17, 2019 · 2 comments
Open

What happens on connection error ? #41

atassis opened this issue Dec 17, 2019 · 2 comments
Milestone

Comments

@atassis
Copy link
Collaborator

atassis commented Dec 17, 2019

If we are not making any queries for a long time, we can meet a RethinkDBError with type CONNECTION. Why the library is not handling such a case by itselves? As well there is no option to set minimum of existing connections at a time, so we have to write a wrapper above .run() which checks if connection error is thrown or not.
Exact message of error is "The connection was closed before the query could be completed".
Node v12.13.1
Package version 2.4.0-rc.16
Any other needed information can be provided

@ronzeidman
Copy link

of course there is, you can set a connection pool, buffer is the min number of connections:

r.connectPool({
  db?: string; // default 'test'
  user?: string; // default 'admin'
  password?: string; // default ''
  discovery?: boolean; // default false
  pool?: boolean; // default true
  buffer?: number; // default = number of servers
  max?: number; // default = number of servers
  timeout?: number; // default = 20
  pingInterval?: number; // default -1
  timeoutError?: number; // default = 1000
  timeoutGb?: number; // default = 60*60*1000
  maxExponent?: number; // default 6
  silent?: boolean; // default = false
  log?: (message: string) => any; // default undefined;
  [other: string]: any;
})

@ronzeidman
Copy link

ronzeidman commented Dec 19, 2019

never encountered that kind of error before but I'm guessing if you set a ping interval you can avoid it, ping interval is in milliseconds and it sends a ping to all open connections for every interval amount of time

@atassis atassis added this to the Version 3.0 milestone May 11, 2021
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

No branches or pull requests

2 participants