1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 19:47:43 +02:00

remove tokio runners (#253)

This commit is contained in:
Rob Ede
2021-01-29 02:21:06 +00:00
committed by GitHub
parent feac376c17
commit ba39c8436d
10 changed files with 103 additions and 337 deletions

View File

@ -401,7 +401,7 @@ impl Accept {
// after the sleep a Timer interest is sent to Accept Poll
let waker = self.waker.clone();
System::current().arbiter().send(Box::pin(async move {
System::current().arbiter().spawn(Box::pin(async move {
sleep_until(Instant::now() + Duration::from_millis(510)).await;
waker.wake(WakerInterest::Timer);
}));

View File

@ -6,7 +6,7 @@ use std::{io, mem};
use actix_rt::net::TcpStream;
use actix_rt::time::{sleep_until, Instant};
use actix_rt::{spawn, System};
use actix_rt::{self as rt, System};
use log::{error, info};
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver};
use tokio::sync::oneshot;
@ -288,7 +288,7 @@ impl ServerBuilder {
// start http server actor
let server = self.server.clone();
spawn(self);
rt::spawn(self);
server
}
}
@ -364,7 +364,7 @@ impl ServerBuilder {
let fut = join_all(iter);
spawn(async move {
rt::spawn(async move {
let _ = fut.await;
if let Some(tx) = completion {
let _ = tx.send(());
@ -373,16 +373,16 @@ impl ServerBuilder {
let _ = tx.send(());
}
if exit {
spawn(async {
rt::spawn(async {
sleep_until(Instant::now() + Duration::from_millis(300)).await;
System::current().stop();
});
}
})
});
} else {
// we need to stop system if server was spawned
if self.exit {
spawn(async {
rt::spawn(async {
sleep_until(Instant::now() + Duration::from_millis(300)).await;
System::current().stop();
});

View File

@ -172,7 +172,7 @@ impl Worker {
let avail = availability.clone();
// every worker runs in it's own arbiter.
Arbiter::new().send(Box::pin(async move {
Arbiter::new().spawn(Box::pin(async move {
availability.set(false);
let mut wrk = MAX_CONNS_COUNTER.with(move |conns| Worker {
rx,