Make authorization thread pool size a const
Moves the definition of the authorization thread pool's size to a
constant so it's not an inline "magic number".
@@ -31,6 +31,8 @@ use crate::transport::{Connection, RecvError};
use self::handlers::create_authorization_dispatcher;
use self::pool::{ThreadPool, ThreadPoolBuilder};
+const AUTHORIZATION_THREAD_POOL_SIZE: usize = 8;
+
/// The states of a connection during authorization.
#[derive(PartialEq, Debug, Clone)]
pub(crate) enum AuthorizationState {
@@ -115,7 +117,7 @@ impl AuthorizationPool {
/// Constructs an AuthorizationPool
pub fn new(local_identity: String) -> Result<Self, AuthorizationPoolError> {
let thread_pool = ThreadPoolBuilder::new()
- .with_size(8)
+ .with_size(AUTHORIZATION_THREAD_POOL_SIZE)
.with_prefix("AuthorizationPool-".into())
.build()
.map_err(|err| AuthorizationPoolError(err.to_string()))?;
