Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

funny return #24

Open
gilescope opened this issue Mar 30, 2022 · 5 comments
Open

funny return #24

gilescope opened this issue Mar 30, 2022 · 5 comments

Comments

@gilescope
Copy link

https://github.com/quietlychris/bissel/blob/8efb2660b521a863c56f58f18e30d9b59d4a2f7e/src/node/active.rs#L49

Where does that return return to? It looks to me like it exits the loop, not just the match. I don't think that's what you wanted (unless I missed something)?

@quietlychris
Copy link
Owner

It's definitely not what I want! Honestly, that bit of code basically falls into the "make it compile" bucket. I'm planning on doing a complete overhaul of the error handling all the way down through Bissel for the next release, which will involve fixing this, adding custom error types (moving away from dyn Error), and probably adding in a library like failure to help with making the whole area a little nicer to deal with.

Thanks for pointing this out; I'll keep this issue open as a reminder to make sure this line is involved in that process.

@quietlychris
Copy link
Owner

This has begun to be addressed in 2e2e4e7, but definitely still some work to do on that handling that ack so that it's not just a String return.

@quietlychris quietlychris mentioned this issue Jan 2, 2024
@quietlychris
Copy link
Owner

@gilescope I know it's been ages since you looked at this, but I've been slowly chipping away at trying to improve this library. If you'd be interested/willing in taking a second look at either this particular issue or poke through the code a bit in general to see if there are any areas that could have the data flow or error handling improved, I'd welcome any additional feedback!

@gilescope
Copy link
Author

gilescope commented Jan 13, 2024 via email

@quietlychris
Copy link
Owner

quietlychris commented Jan 13, 2024

Thank you :) My understanding from https://tokio.rs/tokio/topics/bridging is that calling block_on is basically necessary for moving the result of an async networking call back into synchronous code. Even in the examples where they start on something like a spawn(), getting the owned data back still involves something like

let handle = tokio::spawn(async {
    networking_call().await
});
// Wait in the interim for the spawned task to finish
thread::sleep(Duration::from_millis(a_while));
// Get the result of the networking call back into the sync code
tokio.block_on(handle)?;

I'm trying to mitigate this by having the default Tokio runtime be multi-threaded, but I'm not sure how else to improve this for a request-reply architecture, aside from dropping Tokio entirely for Node-based networking. If you have any suggestions or ideas of where I could look for alternate options, I'd be happy to investigate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants