dmanjunath / node-redshift

A simple collection of tools to help you get started with Amazon Redshift from node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connection Close missing

res-io opened this issue · comments

is there a way to close the connection somehow?

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?

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

@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?

commented

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.

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!