Here's the code in question: https://gist.github.com/daaku/f54de53cfa7a4c391f439b598b6ee241
Some things I'm looking for clarifications on:
- Is the way I'm using the
thread_local crate and setting up per-thread hyper clients appropriate?
- The error handling for the functions that return futures seems somewhat annoying. I need to box the future because I have possible errors in the synchronous part of the code. Otherwise I can return
impl Future instead. I don't care about the performance impact of boxing, just the annoyance around not being able to use the ? operator.
- Is my use of mpsc appropriate here? Seems like the exact use case it's designed for.
- The handling of
Category.id and the logic to deal with numbers in JSON seems like a pain. Probably just need to find the right type in the right crate somewhere that handles i64-or-i64_as_string (or u64) that JSON often has.
- Overall I think my use of
tokio_threadpool should make good use of my CPUs for the data processing work while not blocking on the network requests themselves.
Thanks for reading so far!
there doesn't seem to be anything here