File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ toml = { workspace = true }
44
55
66[dependencies ]
7- async_trait = { workspace = true }
7+ async-trait = { workspace = true }
88config = { workspace = true }
99dashmap = { workspace = true }
1010env_logger = { workspace = true }
@@ -16,10 +16,11 @@ serde = { workspace = true }
1616serde_json = { workspace = true }
1717thiserror = { workspace = true }
1818tokio = { 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 }
2121unbug = { workspace = true }
22- crossbeam_deque = { workspace = true }
22+ crossbeam-deque = { workspace = true }
23+ num_cpus = { workspace = true }
2324
2425[[example ]]
2526name = " Sequence"
Original file line number Diff line number Diff line change 44use crossbeam_deque:: { Injector , Stealer , Worker } ;
55use 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.
1010struct 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 {
Original file line number Diff line number Diff line change @@ -15,9 +15,9 @@ use tokio::task::JoinHandle;
1515/// queue, and task execution lifecycle.
1616use super :: Worker :: Worker ;
1717use 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
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use std::collections::HashMap;
55
66use 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 }
Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments