Better repo actor system #4

Closed
opened 2024-06-19 23:47:21 +02:00 by Jef Roosens · 0 comments
  • On startup, start N actors with their own threads (outside of Tokio, using std:🧵:spawn) that perform repository tasks such as syncing etc.
  • these all listen to the same mspc channel, with the global state containing a repository handle that uses this channel to communicate
  • Each of these actors get a handle to the tokio runtime so they can use block_on to execute async functions while remaining sync themselves (e.g. database operations)
  • the important part here is that we can bring all io into a few threads without having to spam spawn_blocking

based on https://tokio.rs/tokio/topics/bridging#a-synchronous-interface-to-mini-redis

* On startup, start N actors with their own threads (outside of Tokio, using std::thread::spawn) that perform repository tasks such as syncing etc. * these all listen to the same mspc channel, with the global state containing a repository handle that uses this channel to communicate * Each of these actors get a handle to the tokio runtime so they can use `block_on` to execute async functions while remaining sync themselves (e.g. database operations) * the important part here is that we can bring all io into a few threads without having to spam `spawn_blocking` based on https://tokio.rs/tokio/topics/bridging#a-synchronous-interface-to-mini-redis
Jef Roosens added this to the 1.0.0 milestone 2024-06-19 23:47:21 +02:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Chewing_Bever/rieter#4
There is no content yet.