Merge remote-tracking branch 'origin/main' into ap07

This commit is contained in:
Kitaiti Makoto
2022-05-07 11:15:04 +09:00
3 changed files with 10 additions and 2 deletions
+7 -1
View File
@@ -18,7 +18,10 @@ use rocket::{
response::{Responder, Response},
Outcome,
};
use tokio::runtime;
use tokio::{
runtime,
time::{sleep, Duration},
};
use tracing::{debug, warn};
use self::sign::Signable;
@@ -167,6 +170,9 @@ where
let rx = rx.clone();
let handle = rt.spawn(async move {
while let Ok(request_builder) = rx.recv_async().await {
// After broadcasting, target instance sends request to this instance.
// Sleep here in order to reduce requests at once
sleep(Duration::from_millis(500)).await;
let _ = request_builder
.send()
.await