Skip to content

Commit

Permalink
Stop using channels to communicate commands
Browse files Browse the repository at this point in the history
Stop using channels to communicate commands
  • Loading branch information
TTWNO committed Jun 17, 2024
1 parent 587976c commit 334fc2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions odilia/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ async fn main() -> eyre::Result<()> {
tracing::error!("Could not set AT-SPI2 IsEnabled property because: {}", e);
}
let (sr_event_tx, sr_event_rx) = mpsc::channel(128);
let (cmd_tx, cmd_rx) = mpsc::channel::<OdiliaCommand>(128);
// this is the channel which handles all SSIP commands. If SSIP is not allowed to operate on a separate task, then waiting for the receiving message can block other long-running operations like structural navigation.
// Although in the future, this may possibly be resolved through a proper cache, I think it still makes sense to separate SSIP's IO operations to a separate task.
// Like the channel above, it is very important that this is *never* full, since it can cause deadlocking if the other task sending the request is working with zbus.
Expand Down Expand Up @@ -210,7 +209,7 @@ async fn main() -> eyre::Result<()> {
}
}
};
let atspi_handlers_task = handlers.atspi_handler(ev_rx, cmd_tx);
let atspi_handlers_task = handlers.atspi_handler(ev_rx);

//tracker.spawn(atspi_event_receiver);
//tracker.spawn(atspi_event_processor);
Expand Down
6 changes: 3 additions & 3 deletions odilia/src/tower/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ use tower::Layer;
use tower::Service;
use tower::ServiceExt;

use tokio::sync::mpsc::{Receiver, Sender};
use tokio::sync::mpsc::Receiver;

use odilia_cache::{Cache, CacheItem};
use odilia_cache::CacheItem;
use odilia_common::command::{
CommandType, CommandTypeDynamic, OdiliaCommand as Command,
OdiliaCommandDiscriminants as CommandDiscriminants, TryIntoCommands,
Expand Down Expand Up @@ -84,7 +84,7 @@ impl Handlers {
}
}
#[tracing::instrument(skip_all)]
pub async fn atspi_handler<R>(mut self, mut events: R, cmds: Sender<Command>)
pub async fn atspi_handler<R>(mut self, mut events: R)
where
R: Stream<Item = Result<Event, AtspiError>> + Unpin,
{
Expand Down

0 comments on commit 334fc2b

Please sign in to comment.