You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letpool=newPool({max: 5});pool.on('connect',(client)=>{client._ready=newPromise((resolve,reject)=>{client.query('SET search_path to foo, public',(err)=>{if(err){reject(err);}else{resolve();}});});});//...some other placepool.getConnection(function(err,client,release){if(err){// error handling}client._ready.then(()=>{//run some query and on success release the client back to pool//if errors post query execution then also release client back to pool}).catch(err2=>{//some other kind of error handling});});
Inside getConnection() callback function, will _ready always be a promise? Can it ever become undefined? 🤔
The text was updated successfully, but these errors were encountered:
Are there any issues with this pattern of code:
Inside
getConnection()
callback function, will_ready
always be a promise? Can it ever becomeundefined
? 🤔The text was updated successfully, but these errors were encountered: