new feature: `ConcurrentLimitLayer` should accept a `Semaphore`
Feature Description
Add a method to ConcurrentLimitLayer to provide an Arc<Semaphore>.
Problem and Solution
Some applications may have their own semaphores used for limiting concurrency. For example, when limiting a process's open file handles. ConcurrentLimitLayer is already using Arc<Semaphore> internally, so this only needs to be exposed.
Additional Context
No response
Are you willing to contribute to the development of this feature?
- [x] Yes, I am willing to contribute to the development of this feature.
We designed this way because we didn’t want to depend on external APIs like Tokio’s Semaphore. But since we have no other choice, let’s just expose it.
Do you want to implement it?
We designed this way because we didn’t want to depend on external APIs like Tokio’s Semaphore.
Yea it is kind of a shame that we have to choose one semaphore impl. As such, if users want a different semaphore type, they'll just need to implement their own layer.
Do you want to implement it?
Sure, though it might not be a high priority for me. If someone else has time to do it, they should preempt me.