Fix typo and add tracing

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/16/head
trivernis 3 years ago
parent 94c1a7471a
commit 66c81605fc
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -122,7 +122,7 @@ where
T: Clone,
{
fn drop(&mut self) {
self.count.fetch_sub(1, Ordering::Relaxed);
self.release();
}
}
@ -139,12 +139,19 @@ where
/// Acquires the context by adding 1 to the count and
/// returning the cloned variant
pub(crate) fn aqcuire(&self) -> Self {
#[tracing::instrument(level = "trace", skip_all)]
pub(crate) fn acquire(&self) -> Self {
self.count.fetch_add(1, Ordering::Relaxed);
self.clone()
}
/// Releases the connection by subtracting from the stored count
#[tracing::instrument(level = "trace", skip_all)]
pub(crate) fn release(&self) {
self.count.fetch_sub(1, Ordering::Relaxed);
}
pub(crate) fn count(&self) -> usize {
self.count.load(Ordering::Relaxed)
}
@ -166,6 +173,6 @@ impl PooledContext {
.iter()
.min_by_key(|c| c.count())
.unwrap()
.aqcuire()
.acquire()
}
}

Loading…
Cancel
Save