Commit 20cab1a
fix(sync): replace tokio::sync::RwLock with std::sync::RwLock for Actix compatibility
Fixes panic: "can call blocking only when running on the multi-threaded runtime"
The SyncActor was using tokio::sync::RwLock with tokio::task::block_in_place()
to get synchronous access to async locks. However, Actix actors run on a
single-threaded runtime where block_in_place() is not supported.
Changes:
- Replace tokio::sync::RwLock with std::sync::RwLock for state management
- Remove all block_in_place() patterns (6 occurrences)
- Convert .write().await/.read().await to .write().unwrap()/.read().unwrap()
- Restructure checkpoint interval to check state outside tokio::spawn()
(RwLockReadGuard is not Send)
This is safe because:
1. Actix actors are single-threaded, so no concurrent access
2. Lock holds are brief (just field reads/writes)
3. Lock poisoning will panic, which is appropriate for critical state errors
Co-Authored-By: Claude <[email protected]>1 parent 1c8086b commit 20cab1a
1 file changed
+91
-97
lines changed
0 commit comments