Skip to content

Commit

Permalink
Fix supported versions to include -rc
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiezzel committed May 16, 2024
1 parent 91ae986 commit 4458d8e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions crates/network-scheduler/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ use crate::scheduling_unit::{SchedulingUnit, UnitId};
use crate::worker_state::{JailReason, WorkerState};

lazy_static! {
pub static ref SUPPORTED_WORKER_VERSIONS: VersionReq = ">=0.4.0".parse().unwrap();
pub static ref SUPPORTED_WORKER_VERSIONS: [VersionReq; 2] = [
">=0.4.0".parse().unwrap(),
">=1.0.0-rc1".parse().unwrap(), // >=0.4.0 does not match release candidates
];
}
const WORKER_ID_HEADER: &str = "worker-id";
const WORKER_SIGNATURE_HEADER: &str = "worker-signature";
Expand Down Expand Up @@ -87,7 +90,10 @@ impl Scheduler {
/// Register ping msg from a worker. Returns worker status if ping was accepted, otherwise None
pub fn ping(&mut self, worker_id: PeerId, msg: Ping) -> WorkerStatus {
let version = msg.sem_version();
if !SUPPORTED_WORKER_VERSIONS.matches(&version) {
if !SUPPORTED_WORKER_VERSIONS
.iter()
.any(|v| v.matches(&version))
{
log::debug!("Worker {worker_id} version not supported: {}", version);
return WorkerStatus::UnsupportedVersion(());
}
Expand Down
10 changes: 8 additions & 2 deletions crates/query-gateway/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ use crate::task::Task;
const COMP_UNITS_PER_QUERY: u32 = 1;

lazy_static! {
pub static ref SUPPORTED_WORKER_VERSIONS: VersionReq = ">=0.3.0".parse().unwrap();
pub static ref SUPPORTED_WORKER_VERSIONS: [VersionReq; 2] = [
">=0.4.0".parse().unwrap(),
">=1.0.0-rc1".parse().unwrap(), // >=0.4.0 does not match release candidates
];
}

pub struct Server<S: Stream<Item = GatewayEvent> + Send + Unpin + 'static> {
Expand Down Expand Up @@ -230,7 +233,10 @@ impl<S: Stream<Item = GatewayEvent> + Send + Unpin + 'static> Server<S> {
log::trace!("Ping from {peer_id}: {ping:?}");

let version = ping.sem_version();
if !SUPPORTED_WORKER_VERSIONS.matches(&version) {
if !SUPPORTED_WORKER_VERSIONS
.iter()
.any(|v| v.matches(&version))
{
return log::debug!("Worker {peer_id} version not supported: {}", version);
}

Expand Down

0 comments on commit 4458d8e

Please sign in to comment.