Skip to content

Commit

Permalink
updatehub: Fix single thread execution
Browse files Browse the repository at this point in the history
API and state machine futures have been set to run on the same thread to avoid
spawning on a single threaded environment

Signed-off-by: Jonathas-Conceicao <jonathas.conceicao@ossystems.com.br>
  • Loading branch information
Jonathas-Conceicao authored and otavio committed May 21, 2021
1 parent 4bc7641 commit cb28a8f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion updatehub/src/states/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ pub async fn run(settings: &Path) -> crate::Result<()> {

let machine = machine::StateMachine::new(State::new(), settings, runtime_settings, firmware);
let addr = machine.address();
async_std::task::spawn(machine.start());
// Use a local spawn since spawned file write operations can get stucked on
// single threaded envirements:
// https://github.com/async-rs/async-std/issues/973
async_std::task::spawn_local(machine.start());

http_api::Api::server(addr).listen(listen_socket).await?;

Expand Down

0 comments on commit cb28a8f

Please sign in to comment.