{"action":"opened","issue":{"url":"https://api.github.com/repos/coopernurse/node-pool/issues/93","labels_url":"https://api.github.com/repos/coopernurse/node-pool/issues/93/labels{/name}","comments_url":"https://api.github.com/repos/coopernurse/node-pool/issues/93/comments","events_url":"https://api.github.com/repos/coopernurse/node-pool/issues/93/events","html_url":"https://github.com/coopernurse/node-pool/issues/93","id":70296207,"number":93,"title":"Is it possible to have a callback when the minimum number of connections is created?","user":{"login":"abhikco","id":10337202,"avatar_url":"https://avatars.githubusercontent.com/u/10337202?v=3","gravatar_id":"","url":"https://api.github.com/users/abhikco","html_url":"https://github.com/abhikco","followers_url":"https://api.github.com/users/abhikco/followers","following_url":"https://api.github.com/users/abhikco/following{/other_user}","gists_url":"https://api.github.com/users/abhikco/gists{/gist_id}","starred_url":"https://api.github.com/users/abhikco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhikco/subscriptions","organizations_url":"https://api.github.com/users/abhikco/orgs","repos_url":"https://api.github.com/users/abhikco/repos","events_url":"https://api.github.com/users/abhikco/events{/privacy}","received_events_url":"https://api.github.com/users/abhikco/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-23T03:36:02Z","updated_at":"2015-04-23T03:36:02Z","closed_at":null,"body":"Pretty cool module, I must say.\r\nI am using it for a project of mine and I couldn't find out whether it's really possible or not. Can the pool call a custom callback when the minimum number of connections are created?\r\n\r\nExample:\r\nI am using the following piece of code to create the pool. Would it be possible to have a callback executed when the minimum number of connections (in this case, 3) is created?\r\n\r\n```\r\nvar pool = gp.Pool({\r\n\t\tname : 'connection_pool',\r\n\t\tvalidate : function(client) {\r\n\t\t\tconsole.log('INFO- Validate called:' + (!client.hadError && client.readyState === 'connected'));\r\n\t\t\treturn (!client.hadError && client.readyState === 'connected');\r\n\t\t},\r\n\t\tdestroy : function(client) {\r\n\t\t\t// if the client is already closed don't call end\r\n\t\t\tif (!client.hadError && client.readyState !== 'closed') {\r\n\t\t\t\tclient.end();\r\n\t\t\t}\r\n\t\t},\r\n\t\tmax : 25,\r\n\t\tmin : 3,\r\n\t\tidleTimeoutMillis : 30000,\r\n\t\tlog : false,\r\n\t\trefreshIdle : true,\r\n\t\tcreate : function(callback) {\r\n\t\t\toptions.autoReconnect = true;\r\n\t\t\tvar client = hdb.createClient(options);\r\n\t\t\tclient.hadError = false;\r\n\t\t\tclient.once('error', function onerror(err) {\r\n\t\t\t\tconsole.error('Client error:', err);\r\n\t\t\t\tclient.hadError = true;\r\n\t\t\t});\r\n\t\t\tclient.connect(function(err) {\r\n\t\t\t\tif (err) {\r\n\t\t\t\t\treturn console.error(\"Error:\" + err);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\tcallback(null, client);\r\n\t\t}\r\n\t});\r\n```"}}