mysql icon indicating copy to clipboard operation
mysql copied to clipboard

Use LIFO for returning/retrieving connections from the pool

Open 4ver opened this issue 6 years ago • 10 comments

The current way this works (cycling through all of the connections) means that you can't make use of mysql's wait_timeout setting for closing inactive connections. Once a connection is created it will be persisted forever unless you have very low levels of activity.

Was there a reason to cycle round-robin through the connections when this was initially implemented?

4ver avatar Aug 16 '18 15:08 4ver

Will do 👍

4ver avatar Aug 16 '18 15:08 4ver

As for why it was initially implemented as rr it was before my time so I have no idea :)

dougwilson avatar Aug 16 '18 15:08 dougwilson

The implementation and test itself look good, though :+1:

dougwilson avatar Aug 16 '18 15:08 dougwilson

The test failures are a little funny, but it looks like I may have broken the PoolCluster RR stuff.

4ver avatar Aug 16 '18 16:08 4ver

Must have just been a randomly failing test. Should be good to go now 🙆

4ver avatar Aug 17 '18 09:08 4ver

https://github.com/mysqljs/mysql/pull/1749 can probably be closed off if this pr gets merged.

4ver avatar Aug 17 '18 13:08 4ver

Gentle bump on this 😃. Had a chance to take a look over it @dougwilson ?

4ver avatar Aug 23 '18 12:08 4ver

Not since my initial look as I have been away. I will get back soon and take a look at the new changes

dougwilson avatar Aug 23 '18 12:08 dougwilson

All good 👍 Thanks for the message.

4ver avatar Aug 23 '18 12:08 4ver

Did you get a chance to take a look over it? @dougwilson Thanks!

DiegoAlanis avatar Oct 04 '19 19:10 DiegoAlanis