[SCALABILITY] Sync Mutex in Async Context (Job State) #21
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
geomind_code/my_fs#21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In
src/server/handlers.rs, thejobs_stateis managed using a standardstd::sync::Mutex(Line 216):Risk: Locking a synchronous mutex in an
asyncfunction (especially one usingtokio::spawn) can block the entire Tokio executor thread if a thread holds the lock for too long, essentially "starving" other concurrent tasks.Fix: Replace
std::sync::Mutexwithtokio::sync::Mutexor use an actor pattern/dashmap to handle the job state concurrently without blocking executors.