refactor(redis): spawn one subscriber thread for handling all the published messages to different channel (#5064)

This commit is contained in:
Chethan Rao
2024-06-21 17:01:52 +05:30
committed by GitHub
parent 2005d3df9f
commit 6a07e10af3
5 changed files with 159 additions and 125 deletions

View File

@ -68,6 +68,7 @@ impl RedisClient {
pub struct SubscriberClient {
inner: fred::clients::SubscriberClient,
pub is_subscriber_handler_spawned: Arc<atomic::AtomicBool>,
}
impl SubscriberClient {
@ -83,7 +84,10 @@ impl SubscriberClient {
.wait_for_connect()
.await
.change_context(errors::RedisError::RedisConnectionError)?;
Ok(Self { inner: client })
Ok(Self {
inner: client,
is_subscriber_handler_spawned: Arc::new(atomic::AtomicBool::new(false)),
})
}
}