Actually run all the components in parallel threads
I have much to learn about async Rust, but the gist of it is that running try_join on a bunch of futures makes it run them in one task which is not at all what I want because all the components here are separate from each other. Apparently to make it spawn separate tasks, you need to use tokio::spawn. You live and learn. Ideally of course these should be separate processes entirely, but for now I'm far too lazy to deal with that
This commit is contained in:
parent
635e8506c6
commit
51b5d6de71
|
@ -54,10 +54,10 @@ async fn main() -> Result<()> {
|
|||
|
||||
info!("Starting everything up");
|
||||
|
||||
tokio::try_join!(
|
||||
post_indexer.start(),
|
||||
profile_classifier.start(),
|
||||
feed_server.serve(),
|
||||
let _ = tokio::try_join!(
|
||||
tokio::spawn(post_indexer.start()),
|
||||
tokio::spawn(profile_classifier.start()),
|
||||
tokio::spawn(feed_server.serve()),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -34,7 +34,7 @@ impl PostIndexer {
|
|||
}
|
||||
|
||||
impl PostIndexer {
|
||||
pub async fn start(&self) -> Result<()> {
|
||||
pub async fn start(self) -> Result<()> {
|
||||
info!("Starting");
|
||||
|
||||
loop {
|
||||
|
|
|
@ -23,7 +23,7 @@ impl ProfileClassifier {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn start(&self) -> Result<()> {
|
||||
pub async fn start(self) -> Result<()> {
|
||||
info!("Starting");
|
||||
|
||||
loop {
|
||||
|
|
Loading…
Reference in New Issue