[CDRIVER-382] Expose mongoc_client_pool_t size in API for active connections Created: 19/Jun/14  Updated: 03/May/17  Resolved: 25/Jun/14

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Eoin Brazil Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends

 Description   

Hi All,

Is it possible to provide an API or mechanism to expose the the mongoc_client_pool_t size attribute to shows the # of outstanding connections ?

Thanks!
Eoin



 Comments   
Comment by Christian Hergert [ 25/Jun/14 ]

I'm going to close this wont-fix without further understanding of needs. I'm adverse to adding things that will inherently be racy. If we have a good reason for needing access to this, we could potentially add lock/unlock functions to the pool (but I'm skeptical).

Comment by Christian Hergert [ 19/Jun/14 ]

The primary problem here is that exposing the number of free connections alone would be a race condition. (We'd have to also add lock/unlock functions for the thread-safe queue).

We do have mongoc_client_pool_try_pop() if you need to try to get a connection and do something else if a connection is not yet available. (It returns NULL in the case that all connections are checked out).

It would help to know what the goal is by knowing the free connection count.

Generated at Wed Feb 07 21:09:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.