* Don't create a CommandExecutor if there are no observers. (#603) * Don't log if our executor channel goes away. This is routine.
This commit is contained in:
parent
9f30fe6295
commit
66b892572c
1 changed files with 9 additions and 1 deletions
|
@ -132,6 +132,11 @@ impl TxObservationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn in_progress_did_commit(&mut self, txes: IndexMap<Entid, AttributeSet>) {
|
pub fn in_progress_did_commit(&mut self, txes: IndexMap<Entid, AttributeSet>) {
|
||||||
|
// Don't spawn a thread only to say nothing.
|
||||||
|
if !self.has_observers() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let executor = self.executor.get_or_insert_with(|| {
|
let executor = self.executor.get_or_insert_with(|| {
|
||||||
let (tx, rx): (Sender<Box<Command + Send>>, Receiver<Box<Command + Send>>) = channel();
|
let (tx, rx): (Sender<Box<Command + Send>>, Receiver<Box<Command + Send>>) = channel();
|
||||||
let mut worker = CommandExecutor::new(rx);
|
let mut worker = CommandExecutor::new(rx);
|
||||||
|
@ -195,7 +200,10 @@ impl CommandExecutor {
|
||||||
loop {
|
loop {
|
||||||
match self.receiver.recv() {
|
match self.receiver.recv() {
|
||||||
Err(RecvError) => {
|
Err(RecvError) => {
|
||||||
eprintln!("Disconnected, terminating CommandExecutor");
|
// "The recv operation can only fail if the sending half of a channel (or
|
||||||
|
// sync_channel) is disconnected, implying that no further messages will ever be
|
||||||
|
// received."
|
||||||
|
// No need to log here.
|
||||||
return
|
return
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue