4

Is there a way to get a SystemRunner object from the current System (which I am getting from System::current()). I can't find a way to do it through the documentation, but I feel like it should exist.

I have an endpoint where a user might call a method that uses block_on, which requires an instance of SystemRunner to run on. I want to avoid calling System::new("actix") again and just use the System that is currently running.

kmdreko
  • 42,554
  • 6
  • 57
  • 106
MarcioPorto
  • 555
  • 7
  • 22

1 Answers1

1

There is no way to block_on running System.

For tests you can use block_on helper in testing tools of actix-web: https://github.com/actix/actix-web/blob/master/src/test.rs#L60 that creates local runtime and blocks on the current thread.

ilblackdragon
  • 1,834
  • 12
  • 12