Return an instance to the pool after use.
(&self, tenant_id: u64, func_name: &str, instance: PooledInstance)
| 65 | |
| 66 | /// Return an instance to the pool after use. |
| 67 | pub fn release(&self, tenant_id: u64, func_name: &str, instance: PooledInstance) { |
| 68 | let key = (tenant_id, func_name.to_string()); |
| 69 | let mut pools = self.pools.lock().unwrap_or_else(|p| p.into_inner()); |
| 70 | let pool = pools.entry(key).or_default(); |
| 71 | if pool.len() < self.pool_size { |
| 72 | pool.push(instance); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /// Pre-warm the pool for a tenant+function. |
| 77 | pub fn warm( |