dmanjunath / node-redshift

A simple collection of tools to help you get started with Amazon Redshift from node.js
69 stars 48 forks source link

Connection Close missing #4

Closed res-io closed 7 years ago

res-io commented 8 years ago

is there a way to close the connection somehow?

dmanjunath commented 8 years ago

Because the module relies on node-pg under the hood and it connects using client pooling, node-pg just handles opening and closing connections automatically so I hadn't really considered adding a close connection function. But it seems like a good thing to have.

What do you think in terms of expected behavior? Disconnect all the clients from the pool?

jasonfungsing commented 8 years ago

I am running into the same issue. Connection not been close after query.

dmanjunath commented 8 years ago

@jasonfungsing Two questions.

  1. Are you trying to open the connection and close it after every query? If you want to close it every time I think one way to handle that would be to have a parameter when you initialize the redshift connection that can create a raw connection. Right now it defaults to client pooling and it doesn't ever end the connection because it keeps the pool open.

2.Do you have some sample code to help me reproduce the problem?

gdxhsw commented 8 years ago

Hi I am running into the same issue.

My case is that I wrote an AWS lambda function and after all process done I need to close all connection, otherwise the Lambda function won't be finished and then timeout.

dmanjunath commented 7 years ago

Hey guys,

As of the 0.1.0 release I've added added two new features:

  1. You can now specify either a connection pool or raw one time use connection
  2. Close connection functions for both types of connections.

Please look at the new examples/ folder for how to use and close each type of connection. And please let me know if you have more feedback!