expose PayloadTaskGuard from reth_basic_payload_builder (#7945)

This commit is contained in:
Alex Stokes
2024-04-28 09:18:46 -06:00
committed by GitHub
parent ead0fbf8fc
commit cf6d34cf3d

View File

@ -226,12 +226,13 @@ pub struct PrecachedState {
/// Restricts how many generator tasks can be executed at once. /// Restricts how many generator tasks can be executed at once.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
struct PayloadTaskGuard(Arc<Semaphore>); pub struct PayloadTaskGuard(Arc<Semaphore>);
// === impl PayloadTaskGuard === // === impl PayloadTaskGuard ===
impl PayloadTaskGuard { impl PayloadTaskGuard {
fn new(max_payload_tasks: usize) -> Self { /// Constructs `Self` with a maximum task count of `max_payload_tasks`.
pub fn new(max_payload_tasks: usize) -> Self {
Self(Arc::new(Semaphore::new(max_payload_tasks))) Self(Arc::new(Semaphore::new(max_payload_tasks)))
} }
} }