Closed hmeine closed 1 year ago
I am trying to get my head back into this fundamental problem and how I tried to approach it. If I remember correctly, the idea was the following:
main.rs
, and then called functions on the mutable state. This was fine as long as all methods were very small and did not have .await points. However, now that we want to do networking inside, I must not hold the mutex which is currently the basis for &mut self
.&mut self
in ZingState
and instead take the state wrapped in the mutex (or RwLock
, as I learned in the meantime). In particular, this allows me to drop the lock before .await'ing.Table
struct which is used in ZingState
.
I have started implementing a WebSocket handler, but I have problems with async Rust, and it is not yet able to send notifications.
thread 'tokio-runtime-worker' panicked at 'Cannot block the current thread from within a runtime. This happens because a function attempted to block the current thread while the thread is being used to drive asynchronous tasks.'