Skip to content

Conversation

p-mongo
Copy link
Contributor

@p-mongo p-mongo commented Feb 19, 2019

No description provided.

# @since 2.0.0
def pool
@pool ||= cluster.pool(self)
@pool_lock.synchronize do
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't look like the pool will ever be finalized unless the server itself is; why not just define a finalizer on server itself (or on all pools in the pool implementation) instead of defining one on the pool here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instance variables of an object being finalized are not available. What exactly are you proposing to do?

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand that. Let me rephrase my question; is there any reason why we only want to define finalizers to clean up connection pools that are instance variables of servers instead of just defining one in either the connection pool constructor or ConnectionPool#get?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Having the finalizer be set by the connection pool constructor is a better idea indeed.

@p-mongo p-mongo merged commit 3f84a4a into mongodb:master Feb 21, 2019
@p-mongo p-mongo deleted the 1727 branch February 21, 2019 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants