Skip to content

Commit 2e2fa42

Browse files
1 parent 006b9b9 commit 2e2fa42

5 files changed

Lines changed: 13 additions & 12 deletions

File tree

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ toml = { workspace = true }
44

55

66
[dependencies]
7-
async_trait = { workspace = true }
7+
async-trait = { workspace = true }
88
config = { workspace = true }
99
dashmap = { workspace = true }
1010
env_logger = { workspace = true }
@@ -16,10 +16,11 @@ serde = { workspace = true }
1616
serde_json = { workspace = true }
1717
thiserror = { workspace = true }
1818
tokio = { workspace = true }
19-
tokio_console = { workspace = true, optional = true }
20-
tokio_tungstenite = { workspace = true }
19+
tokio-console = { workspace = true, optional = true }
20+
tokio-tungstenite = { workspace = true }
2121
unbug = { workspace = true }
22-
crossbeam_deque = { workspace = true }
22+
crossbeam-deque = { workspace = true }
23+
num_cpus = { workspace = true }
2324

2425
[[example]]
2526
name = "Sequence"

Source/Queue/StealingQueue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use crossbeam_deque::{Injector, Stealer, Worker};
55
use rand::seq::SliceRandom;
66

7-
use crate::Task::{Priority, Task};
7+
use crate::Task::{Priority::Priority, Task::Task};
88

99
/// A container for a set of queues for a single priority level.
1010
struct PriorityQueueSet {
@@ -84,7 +84,7 @@ impl StealingQueue {
8484
// Try stealing from peers for this priority set. We shuffle the indices
8585
// to ensure fairness and avoid contention hotspots.
8686
let mut ShuffledIndex:Vec<usize> = (0..Set.Stealer.len()).collect();
87-
ShuffledIndex.shuffle(&mut rand::thread_rng());
87+
ShuffledIndex.shuffle(&mut rand::rng());
8888

8989
for Index in ShuffledIndex {
9090
if Index == WorkerId {

Source/Scheduler/Scheduler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use tokio::task::JoinHandle;
1515
/// queue, and task execution lifecycle.
1616
use super::Worker::Worker;
1717
use crate::{
18-
Queue::StealingQueue,
18+
Queue::StealingQueue::StealingQueue,
1919
Scheduler::SchedulerBuilder::Concurrency,
20-
Task::{Priority, Task},
20+
Task::{Priority::Priority, Task::Task},
2121
};
2222

2323
/// Manages a pool of worker threads and a work-stealing queue to execute tasks

Source/Scheduler/SchedulerBuilder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::collections::HashMap;
55

66
use log::warn;
77

8-
use super::Scheduler;
8+
use super::Scheduler::Scheduler;
99

1010
/// An enum to define concurrency limits for named queues.
1111
#[derive(Debug, Clone, Copy)]
@@ -33,7 +33,7 @@ impl SchedulerBuilder {
3333
/// By default, the worker count is set to the number of logical CPUs on the
3434
/// system, with a minimum of 2.
3535
pub fn New() -> Self {
36-
let DefaultWorkerCount = num_cpus::get().max(2).expect("");
36+
let DefaultWorkerCount = num_cpus::get().max(2);
3737
Self { WorkerCount:DefaultWorkerCount, QueueConfiguration:HashMap::new() }
3838
}
3939

@@ -45,7 +45,7 @@ impl SchedulerBuilder {
4545
pub fn WithWorkerCount(mut self, WorkerCount:usize) -> Self {
4646
if WorkerCount == 0 {
4747
warn!("[SchedulerBuilder] Worker count of 0 is invalid. Defaulting to number of logical CPUs.");
48-
self.WorkerCount = num_cpus::get().max(2).expect("");
48+
self.WorkerCount = num_cpus::get().max(2);
4949
} else {
5050
self.WorkerCount = WorkerCount;
5151
}

Source/Scheduler/Worker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use tokio::time::{Duration, sleep};
1010
/// @description Defines the `Worker` struct, which represents a single
1111
/// execution thread in the scheduler's pool. This is an internal component of
1212
/// the scheduler.
13-
use crate::Queue::StealingQueue;
13+
use crate::Queue::StealingQueue::StealingQueue;
1414

1515
/// Represents a single worker thread that continuously polls the work-stealing
1616
/// queue for tasks to execute.

0 commit comments

Comments
 (0)