mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-07 12:04:30 +01:00
Send the WakeUp message if necessary in the reserve function
This commit is contained in:
parent
0459b1a242
commit
96831ed9bb
@ -459,12 +459,6 @@ impl<'b> ExtractorBbqueueSender<'b> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// We only send a wake up message when the channel is empty
|
|
||||||
// so that we don't fill the channel with too many WakeUps.
|
|
||||||
if self.sender.is_empty() {
|
|
||||||
self.sender.send(ReceiverAction::WakeUp).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,12 +511,6 @@ impl<'b> ExtractorBbqueueSender<'b> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// We only send a wake up message when the channel is empty
|
|
||||||
// so that we don't fill the channel with too many WakeUps.
|
|
||||||
if self.sender.is_empty() {
|
|
||||||
self.sender.send(ReceiverAction::WakeUp).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,12 +575,6 @@ impl<'b> ExtractorBbqueueSender<'b> {
|
|||||||
key_value_writer(key_buffer, value_buffer)
|
key_value_writer(key_buffer, value_buffer)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// We only send a wake up message when the channel is empty
|
|
||||||
// so that we don't fill the channel with too many WakeUps.
|
|
||||||
if self.sender.is_empty() {
|
|
||||||
self.sender.send(ReceiverAction::WakeUp).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -640,18 +622,13 @@ impl<'b> ExtractorBbqueueSender<'b> {
|
|||||||
key_writer(remaining)
|
key_writer(remaining)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// We only send a wake up message when the channel is empty
|
|
||||||
// so that we don't fill the channel with too many WakeUps.
|
|
||||||
if self.sender.is_empty() {
|
|
||||||
self.sender.send(ReceiverAction::WakeUp).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to reserve a frame grant of `total_length` by spin looping
|
/// Try to reserve a frame grant of `total_length` by spin
|
||||||
/// on the BBQueue buffer and panics if the receiver has been disconnected.
|
/// looping on the BBQueue buffer, panics if the receiver
|
||||||
|
/// has been disconnected or send a WakeUp message if necessary.
|
||||||
fn reserve_and_write_grant<F>(
|
fn reserve_and_write_grant<F>(
|
||||||
producer: &mut FrameProducer,
|
producer: &mut FrameProducer,
|
||||||
total_length: usize,
|
total_length: usize,
|
||||||
@ -668,6 +645,13 @@ where
|
|||||||
// We could commit only the used memory.
|
// We could commit only the used memory.
|
||||||
f(&mut grant)?;
|
f(&mut grant)?;
|
||||||
grant.commit(total_length);
|
grant.commit(total_length);
|
||||||
|
|
||||||
|
// We only send a wake up message when the channel is empty
|
||||||
|
// so that we don't fill the channel with too many WakeUps.
|
||||||
|
if sender.is_empty() {
|
||||||
|
sender.send(ReceiverAction::WakeUp).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Err(bbqueue::Error::InsufficientSize) => continue,
|
Err(bbqueue::Error::InsufficientSize) => continue,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user