Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(actix): Migrate the RelayCache actor #1485

Merged
merged 11 commits into from
Sep 21, 2022
Prev Previous commit
Next Next commit
fix: Use compat to send legacy message
jan-auer committed Sep 20, 2022
commit 8ba71063fd0ee916dcde649c993c4a5c70abb8b6
13 changes: 4 additions & 9 deletions relay-server/src/actors/relays.rs
Original file line number Diff line number Diff line change
@@ -5,15 +5,14 @@ use std::time::{Duration, Instant};

use actix::SystemService;
use actix_web::http::Method;
use futures::compat::Future01CompatExt;
use serde::{Deserialize, Serialize};
use tokio::sync::mpsc;

use relay_auth::{PublicKey, RelayId};
use relay_common::RetryBackoff;
use relay_config::{Config, RelayInfo};
use relay_log::LogError;
use relay_system::{Addr, AsyncResponse, FromMessage, Interface, Sender, Service};
use relay_system::{compat, Addr, AsyncResponse, FromMessage, Interface, Sender, Service};

use crate::actors::upstream::{RequestPriority, SendQuery, UpstreamQuery, UpstreamRelay};
use crate::service::REGISTRY;
@@ -210,15 +209,11 @@ impl RelayCacheService {
relay_ids: channels.keys().cloned().collect(),
};

let send_result = UpstreamRelay::from_registry()
.send(SendQuery(request))
.compat()
.await;

let query_result = match send_result {
let upstream = UpstreamRelay::from_registry();
let query_result = match compat::send(upstream, SendQuery(request)).await {
Ok(inner) => inner,
// Drop the senders to propagate the SendError up.
Err(_) => return,
Err(_send_error) => return,
};

let fetch_result = match query_result {