Replies: 1 comment 1 reply
-
ntex::channel is not thread safe. you have to use thread-safe async channel, something like |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to implement response handler which should generate a very large JSON result in a separate thread, one property at the time. I wish that server starts sending response by sending headers first and the opening brace followed by the first property - value pair, then to send each property as it is produced by the separate thread. I wish to avoid having the entire JSON object in the memory. Instead I wish to produce it peace by peace and send it as soon as the buffer fills up.
I've tried many things but without success. Here is where I am right now:
Compiler complains about
std::rc::Rc<UnsafeCell<ntex::channel::mpsc::Shared<ntex::util::Bytes>>>` cannot be sent between threads safely
Can anyone help me achieve my goal or direct me in the right direction.
Beta Was this translation helpful? Give feedback.
All reactions