Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Conversation

@pitr
Copy link
Contributor

@pitr pitr commented Dec 14, 2015

Switch to use a stack datastructure to store connections. Current implementation uses FIFO strategy, which prevents unused connections from being closed because object pool goes through all connections. With LIFO strategy, unused connections will stay at the bottom of the stack and will be cleaned up during testObjects call.

Additionally, declare waitQueue as Queue for clarity.

Switch to use a stack datastructure to store connections. Current implementation uses FIFO strategy, which prevents unused connections from being closed because object pool goes through all connections. With LIFO strategy, unused connections will stay at the bottom of the stack and will be cleaned up during `testObjects` call.

Additionally, declare `waitQueue` as `Queue` for clarity.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why var?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because of line 244: this.poolables = this.poolables.diff(removals). Unfortunately mutable.Stack doesn't support removing elements that are not the top item, as far as I know.

@mauricio
Copy link
Owner

Thanks @pitr !

mauricio added a commit that referenced this pull request Dec 16, 2015
Switch to LIFO for object pool strategy
@mauricio mauricio merged commit 05c663a into mauricio:master Dec 16, 2015
@pitr
Copy link
Contributor Author

pitr commented Dec 16, 2015

oh, i expected more scrutiny :) thanks!

@pitr pitr deleted the patch-1 branch December 16, 2015 21:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants