Skip to content

Commit

Permalink
Optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
amigin committed Feb 21, 2025
1 parent ad22dd2 commit a4de26d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ impl<TMessageModel: MySbMessageDeserializer<Item = TMessageModel>>
let inner = self.inner.as_ref().unwrap();
let mut inner = inner.lock().await;

if let Some(message_id) = inner.current_message_id.take() {
inner.not_delivered.enqueue(message_id.get_value());
}
inner.current_message_id.take();
}

pub async fn mark_as_delivered(&self) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,11 @@ impl<TMessageModel: MySbMessageDeserializer<Item = TMessageModel> + Send + Sync

if debug {
println!(
"Confirmation: Topic: {}, Queue:{}, Total Amount: {}, Delivered Amount: {}, Not Delivered amount: {}",
"Confirmation: Topic: {}, Queue:{}, Total Amount: {}, Delivered Amount: {}",
data.topic_id.as_str(),
data.queue_id.as_str(),
total_messages_amount,
inner.delivered.queue_size(),
inner.not_delivered.queue_size()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use super::{MySbDeliveredMessage, MySbMessageDeserializer};

pub struct MessagesReaderInner<TMessageModel: MySbMessageDeserializer<Item = TMessageModel>> {
pub delivered: QueueWithIntervals,
pub not_delivered: QueueWithIntervals,
pub prev_intermediary_confirmation_queue: QueueWithIntervals,
pub last_time_confirmation: DateTimeAsMicroseconds,
pub current_message_id: Option<MessageId>,
Expand All @@ -23,7 +22,6 @@ impl<TMessageModel: MySbMessageDeserializer<Item = TMessageModel>>
pub fn new(messages: VecDeque<MySbDeliveredMessage<TMessageModel>>) -> Self {
Self {
delivered: QueueWithIntervals::new(),
not_delivered: QueueWithIntervals::new(),
last_time_confirmation: DateTimeAsMicroseconds::now(),
prev_intermediary_confirmation_queue: QueueWithIntervals::new(),
current_message_id: None,
Expand Down

0 comments on commit a4de26d

Please sign in to comment.