Revert "Upgrade in-tree tokio 0.2 usage to tokio 0.3"

This reverts commit 444ed768dc.
This commit is contained in:
Michael Vines 2020-12-30 20:55:41 -08:00 committed by mergify[bot]
parent 2d8dacb72b
commit 3d077fb656
9 changed files with 75 additions and 60 deletions

57
Cargo.lock generated
View File

@ -2228,6 +2228,18 @@ dependencies = [
"slab", "slab",
] ]
[[package]]
name = "mio-named-pipes"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656"
dependencies = [
"log 0.4.11",
"mio 0.6.22",
"miow 0.3.6",
"winapi 0.3.8",
]
[[package]] [[package]]
name = "mio-uds" name = "mio-uds"
version = "0.6.8" version = "0.6.8"
@ -2705,12 +2717,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f" checksum = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f"
[[package]]
name = "pin-project-lite"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
version = "0.1.0" version = "0.1.0"
@ -3164,7 +3170,7 @@ dependencies = [
"mime_guess", "mime_guess",
"native-tls", "native-tls",
"percent-encoding 2.1.0", "percent-encoding 2.1.0",
"pin-project-lite 0.1.5", "pin-project-lite",
"rustls", "rustls",
"serde", "serde",
"serde_json", "serde_json",
@ -3687,7 +3693,7 @@ dependencies = [
"solana-runtime", "solana-runtime",
"solana-sdk", "solana-sdk",
"tarpc", "tarpc",
"tokio 0.3.5", "tokio 0.3.2",
"tokio-serde", "tokio-serde",
] ]
@ -3699,7 +3705,7 @@ dependencies = [
"serde", "serde",
"solana-sdk", "solana-sdk",
"tarpc", "tarpc",
"tokio 0.3.5", "tokio 0.3.2",
] ]
[[package]] [[package]]
@ -3715,7 +3721,7 @@ dependencies = [
"solana-runtime", "solana-runtime",
"solana-sdk", "solana-sdk",
"tarpc", "tarpc",
"tokio 0.3.5", "tokio 0.3.2",
"tokio-serde", "tokio-serde",
] ]
@ -4050,7 +4056,7 @@ dependencies = [
"tempfile", "tempfile",
"thiserror", "thiserror",
"tokio 0.1.22", "tokio 0.1.22",
"tokio 0.3.5", "tokio 0.2.22",
"tokio-codec", "tokio-codec",
"tokio-fs", "tokio-fs",
"tokio-io", "tokio-io",
@ -4357,7 +4363,7 @@ dependencies = [
"solana-vote-program", "solana-vote-program",
"tempfile", "tempfile",
"thiserror", "thiserror",
"tokio 0.3.5", "tokio 0.2.22",
"trees", "trees",
] ]
@ -4393,7 +4399,7 @@ dependencies = [
"solana-version", "solana-version",
"solana-vote-program", "solana-vote-program",
"tempfile", "tempfile",
"tokio 0.3.5", "tokio 0.2.22",
] ]
[[package]] [[package]]
@ -4670,7 +4676,7 @@ dependencies = [
"solana-program 1.6.0", "solana-program 1.6.0",
"solana-runtime", "solana-runtime",
"solana-sdk", "solana-sdk",
"tokio 0.3.5", "tokio 0.3.2",
] ]
[[package]] [[package]]
@ -5439,7 +5445,7 @@ dependencies = [
"serde", "serde",
"static_assertions", "static_assertions",
"tarpc-plugins", "tarpc-plugins",
"tokio 0.3.5", "tokio 0.3.2",
"tokio-serde", "tokio-serde",
"tokio-util 0.4.0", "tokio-util 0.4.0",
] ]
@ -5640,22 +5646,27 @@ dependencies = [
"futures-core", "futures-core",
"iovec", "iovec",
"lazy_static", "lazy_static",
"libc",
"memchr 2.3.3", "memchr 2.3.3",
"mio 0.6.22", "mio 0.6.22",
"mio-named-pipes",
"mio-uds",
"num_cpus", "num_cpus",
"pin-project-lite 0.1.5", "pin-project-lite",
"signal-hook-registry",
"slab", "slab",
"tokio-macros 0.2.5", "tokio-macros 0.2.5",
"winapi 0.3.8",
] ]
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "0.3.5" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a12a3eb39ee2c231be64487f1fcbe726c8f2514876a55480a5ab8559fc374252" checksum = "71f1b20504fd0aa9dab3ae17e8c4dd9431e5e08fd6921689f9745a4004883a17"
dependencies = [ dependencies = [
"autocfg 1.0.0",
"bytes 0.6.0", "bytes 0.6.0",
"fnv",
"futures-core", "futures-core",
"lazy_static", "lazy_static",
"libc", "libc",
@ -5663,7 +5674,7 @@ dependencies = [
"mio 0.7.6", "mio 0.7.6",
"num_cpus", "num_cpus",
"parking_lot 0.11.0", "parking_lot 0.11.0",
"pin-project-lite 0.2.0", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
"slab", "slab",
"tokio-macros 0.3.1", "tokio-macros 0.3.1",
@ -5918,7 +5929,7 @@ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
"log 0.4.11", "log 0.4.11",
"pin-project-lite 0.1.5", "pin-project-lite",
"tokio 0.2.22", "tokio 0.2.22",
] ]
@ -5932,8 +5943,8 @@ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
"log 0.4.11", "log 0.4.11",
"pin-project-lite 0.1.5", "pin-project-lite",
"tokio 0.3.5", "tokio 0.3.2",
] ]
[[package]] [[package]]

View File

@ -76,7 +76,7 @@ solana-vote-program = { path = "../programs/vote", version = "1.6.0" }
spl-token-v2-0 = { package = "spl-token", version = "=3.0.1", features = ["no-entrypoint"] } spl-token-v2-0 = { package = "spl-token", version = "=3.0.1", features = ["no-entrypoint"] }
tempfile = "3.1.0" tempfile = "3.1.0"
thiserror = "1.0" thiserror = "1.0"
tokio = { version = "0.3", features = ["full"] } tokio = { version = "0.2", features = ["full"] }
tokio_01 = { version = "0.1", package = "tokio" } tokio_01 = { version = "0.1", package = "tokio" }
tokio_01_bytes = { version = "0.4.7", package = "bytes" } tokio_01_bytes = { version = "0.4.7", package = "bytes" }
tokio_fs_01 = { version = "0.1", package = "tokio-fs" } tokio_fs_01 = { version = "0.1", package = "tokio-fs" }

View File

@ -5,7 +5,7 @@ use std::{
sync::{Arc, RwLock}, sync::{Arc, RwLock},
thread::{self, Builder, JoinHandle}, thread::{self, Builder, JoinHandle},
}; };
use tokio::runtime::Runtime; use tokio::runtime;
// Delay uploading the largest confirmed root for this many slots. This is done in an attempt to // Delay uploading the largest confirmed root for this many slots. This is done in an attempt to
// ensure that the `CacheBlockTimeService` has had enough time to add the block time for the root // ensure that the `CacheBlockTimeService` has had enough time to add the block time for the root
@ -21,7 +21,7 @@ pub struct BigTableUploadService {
impl BigTableUploadService { impl BigTableUploadService {
pub fn new( pub fn new(
runtime: Arc<Runtime>, runtime_handle: runtime::Handle,
bigtable_ledger_storage: solana_storage_bigtable::LedgerStorage, bigtable_ledger_storage: solana_storage_bigtable::LedgerStorage,
blockstore: Arc<Blockstore>, blockstore: Arc<Blockstore>,
block_commitment_cache: Arc<RwLock<BlockCommitmentCache>>, block_commitment_cache: Arc<RwLock<BlockCommitmentCache>>,
@ -32,7 +32,7 @@ impl BigTableUploadService {
.name("bigtable-upload".to_string()) .name("bigtable-upload".to_string())
.spawn(move || { .spawn(move || {
Self::run( Self::run(
runtime, runtime_handle,
bigtable_ledger_storage, bigtable_ledger_storage,
blockstore, blockstore,
block_commitment_cache, block_commitment_cache,
@ -45,7 +45,7 @@ impl BigTableUploadService {
} }
fn run( fn run(
runtime: Arc<Runtime>, runtime: runtime::Handle,
bigtable_ledger_storage: solana_storage_bigtable::LedgerStorage, bigtable_ledger_storage: solana_storage_bigtable::LedgerStorage,
blockstore: Arc<Blockstore>, blockstore: Arc<Blockstore>,
block_commitment_cache: Arc<RwLock<BlockCommitmentCache>>, block_commitment_cache: Arc<RwLock<BlockCommitmentCache>>,

View File

@ -78,7 +78,7 @@ use std::{
Arc, Mutex, RwLock, Arc, Mutex, RwLock,
}, },
}; };
use tokio::runtime::Runtime; use tokio::runtime;
pub const MAX_REQUEST_PAYLOAD_SIZE: usize = 50 * (1 << 10); // 50kB pub const MAX_REQUEST_PAYLOAD_SIZE: usize = 50 * (1 << 10); // 50kB
pub const PERFORMANCE_SAMPLES_LIMIT: usize = 720; pub const PERFORMANCE_SAMPLES_LIMIT: usize = 720;
@ -122,7 +122,7 @@ pub struct JsonRpcRequestProcessor {
cluster_info: Arc<ClusterInfo>, cluster_info: Arc<ClusterInfo>,
genesis_hash: Hash, genesis_hash: Hash,
transaction_sender: Arc<Mutex<Sender<TransactionInfo>>>, transaction_sender: Arc<Mutex<Sender<TransactionInfo>>>,
runtime: Arc<Runtime>, runtime_handle: runtime::Handle,
bigtable_ledger_storage: Option<solana_storage_bigtable::LedgerStorage>, bigtable_ledger_storage: Option<solana_storage_bigtable::LedgerStorage>,
optimistically_confirmed_bank: Arc<RwLock<OptimisticallyConfirmedBank>>, optimistically_confirmed_bank: Arc<RwLock<OptimisticallyConfirmedBank>>,
} }
@ -201,7 +201,7 @@ impl JsonRpcRequestProcessor {
health: Arc<RpcHealth>, health: Arc<RpcHealth>,
cluster_info: Arc<ClusterInfo>, cluster_info: Arc<ClusterInfo>,
genesis_hash: Hash, genesis_hash: Hash,
runtime: Arc<Runtime>, runtime: &runtime::Runtime,
bigtable_ledger_storage: Option<solana_storage_bigtable::LedgerStorage>, bigtable_ledger_storage: Option<solana_storage_bigtable::LedgerStorage>,
optimistically_confirmed_bank: Arc<RwLock<OptimisticallyConfirmedBank>>, optimistically_confirmed_bank: Arc<RwLock<OptimisticallyConfirmedBank>>,
) -> (Self, Receiver<TransactionInfo>) { ) -> (Self, Receiver<TransactionInfo>) {
@ -217,7 +217,7 @@ impl JsonRpcRequestProcessor {
cluster_info, cluster_info,
genesis_hash, genesis_hash,
transaction_sender: Arc::new(Mutex::new(sender)), transaction_sender: Arc::new(Mutex::new(sender)),
runtime, runtime_handle: runtime.handle().clone(),
bigtable_ledger_storage, bigtable_ledger_storage,
optimistically_confirmed_bank, optimistically_confirmed_bank,
}, },
@ -253,7 +253,7 @@ impl JsonRpcRequestProcessor {
cluster_info, cluster_info,
genesis_hash, genesis_hash,
transaction_sender: Arc::new(Mutex::new(sender)), transaction_sender: Arc::new(Mutex::new(sender)),
runtime: Arc::new(Runtime::new().expect("Runtime")), runtime_handle: runtime::Runtime::new().unwrap().handle().clone(),
bigtable_ledger_storage: None, bigtable_ledger_storage: None,
optimistically_confirmed_bank: Arc::new(RwLock::new(OptimisticallyConfirmedBank { optimistically_confirmed_bank: Arc::new(RwLock::new(OptimisticallyConfirmedBank {
bank: bank.clone(), bank: bank.clone(),
@ -669,7 +669,7 @@ impl JsonRpcRequestProcessor {
if result.is_err() { if result.is_err() {
if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage { if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage {
return Ok(self return Ok(self
.runtime .runtime_handle
.block_on(bigtable_ledger_storage.get_confirmed_block(slot)) .block_on(bigtable_ledger_storage.get_confirmed_block(slot))
.ok() .ok()
.map(|confirmed_block| confirmed_block.encode(encoding))); .map(|confirmed_block| confirmed_block.encode(encoding)));
@ -712,7 +712,7 @@ impl JsonRpcRequestProcessor {
// [start_slot..end_slot] can be fetched from BigTable. // [start_slot..end_slot] can be fetched from BigTable.
if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage { if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage {
return Ok(self return Ok(self
.runtime .runtime_handle
.block_on( .block_on(
bigtable_ledger_storage bigtable_ledger_storage
.get_confirmed_blocks(start_slot, (end_slot - start_slot) as usize), .get_confirmed_blocks(start_slot, (end_slot - start_slot) as usize),
@ -748,7 +748,7 @@ impl JsonRpcRequestProcessor {
// range can be fetched from BigTable. // range can be fetched from BigTable.
if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage { if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage {
return Ok(self return Ok(self
.runtime .runtime_handle
.block_on(bigtable_ledger_storage.get_confirmed_blocks(start_slot, limit)) .block_on(bigtable_ledger_storage.get_confirmed_blocks(start_slot, limit))
.unwrap_or_else(|_| vec![])); .unwrap_or_else(|_| vec![]));
} }
@ -775,7 +775,7 @@ impl JsonRpcRequestProcessor {
if result.is_err() || matches!(result, Ok(None)) { if result.is_err() || matches!(result, Ok(None)) {
if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage { if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage {
return Ok(self return Ok(self
.runtime .runtime_handle
.block_on(bigtable_ledger_storage.get_confirmed_block(slot)) .block_on(bigtable_ledger_storage.get_confirmed_block(slot))
.ok() .ok()
.and_then(|confirmed_block| confirmed_block.block_time)); .and_then(|confirmed_block| confirmed_block.block_time));
@ -851,7 +851,7 @@ impl JsonRpcRequestProcessor {
}) })
.or_else(|| { .or_else(|| {
if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage { if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage {
self.runtime self.runtime_handle
.block_on(bigtable_ledger_storage.get_signature_status(&signature)) .block_on(bigtable_ledger_storage.get_signature_status(&signature))
.map(Some) .map(Some)
.unwrap_or(None) .unwrap_or(None)
@ -919,7 +919,7 @@ impl JsonRpcRequestProcessor {
None => { None => {
if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage { if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage {
return self return self
.runtime .runtime_handle
.block_on(bigtable_ledger_storage.get_confirmed_transaction(&signature)) .block_on(bigtable_ledger_storage.get_confirmed_transaction(&signature))
.unwrap_or(None) .unwrap_or(None)
.map(|confirmed| confirmed.encode(encoding)); .map(|confirmed| confirmed.encode(encoding));
@ -986,7 +986,7 @@ impl JsonRpcRequestProcessor {
before = results.last().map(|x| x.signature); before = results.last().map(|x| x.signature);
} }
let bigtable_results = self.runtime.block_on( let bigtable_results = self.runtime_handle.block_on(
bigtable_ledger_storage.get_confirmed_signatures_for_address( bigtable_ledger_storage.get_confirmed_signatures_for_address(
&address, &address,
before.as_ref(), before.as_ref(),
@ -1019,7 +1019,7 @@ impl JsonRpcRequestProcessor {
if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage { if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage {
let bigtable_slot = self let bigtable_slot = self
.runtime .runtime_handle
.block_on(bigtable_ledger_storage.get_first_available_block()) .block_on(bigtable_ledger_storage.get_first_available_block())
.unwrap_or(None) .unwrap_or(None)
.unwrap_or(slot); .unwrap_or(slot);
@ -2927,7 +2927,7 @@ pub mod tests {
RpcHealth::stub(), RpcHealth::stub(),
cluster_info.clone(), cluster_info.clone(),
Hash::default(), Hash::default(),
Arc::new(tokio::runtime::Runtime::new().unwrap()), &runtime::Runtime::new().unwrap(),
None, None,
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks), OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks),
); );
@ -4327,7 +4327,7 @@ pub mod tests {
health.clone(), health.clone(),
cluster_info, cluster_info,
Hash::default(), Hash::default(),
Arc::new(tokio::runtime::Runtime::new().unwrap()), &runtime::Runtime::new().unwrap(),
None, None,
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks), OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks),
); );
@ -4523,7 +4523,7 @@ pub mod tests {
RpcHealth::stub(), RpcHealth::stub(),
cluster_info, cluster_info,
Hash::default(), Hash::default(),
Arc::new(tokio::runtime::Runtime::new().unwrap()), &runtime::Runtime::new().unwrap(),
None, None,
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks), OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks),
); );
@ -4555,7 +4555,7 @@ pub mod tests {
RpcHealth::stub(), RpcHealth::stub(),
cluster_info, cluster_info,
Hash::default(), Hash::default(),
Arc::new(tokio::runtime::Runtime::new().unwrap()), &runtime::Runtime::new().unwrap(),
None, None,
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks), OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks),
); );
@ -4646,7 +4646,7 @@ pub mod tests {
RpcHealth::stub(), RpcHealth::stub(),
cluster_info, cluster_info,
Hash::default(), Hash::default(),
Arc::new(tokio::runtime::Runtime::new().unwrap()), &runtime::Runtime::new().unwrap(),
None, None,
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks), OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks),
); );
@ -5826,7 +5826,7 @@ pub mod tests {
RpcHealth::stub(), RpcHealth::stub(),
cluster_info, cluster_info,
Hash::default(), Hash::default(),
Arc::new(tokio::runtime::Runtime::new().unwrap()), &runtime::Runtime::new().unwrap(),
None, None,
optimistically_confirmed_bank.clone(), optimistically_confirmed_bank.clone(),
); );

View File

@ -32,6 +32,7 @@ use std::{
sync::{mpsc::channel, Arc, Mutex, RwLock}, sync::{mpsc::channel, Arc, Mutex, RwLock},
thread::{self, Builder, JoinHandle}, thread::{self, Builder, JoinHandle},
}; };
use tokio::runtime;
pub struct JsonRpcService { pub struct JsonRpcService {
thread_hdl: JoinHandle<()>, thread_hdl: JoinHandle<()>,
@ -40,6 +41,7 @@ pub struct JsonRpcService {
pub request_processor: JsonRpcRequestProcessor, // Used only by test_rpc_new()... pub request_processor: JsonRpcRequestProcessor, // Used only by test_rpc_new()...
close_handle: Option<CloseHandle>, close_handle: Option<CloseHandle>,
runtime: runtime::Runtime,
} }
struct RpcRequestMiddleware { struct RpcRequestMiddleware {
@ -280,13 +282,12 @@ impl JsonRpcService {
)); ));
let tpu_address = cluster_info.my_contact_info().tpu; let tpu_address = cluster_info.my_contact_info().tpu;
let runtime = Arc::new( let mut runtime = runtime::Builder::new()
tokio::runtime::Builder::new_multi_thread() .threaded_scheduler()
.thread_name("rpc-runtime") .thread_name("rpc-runtime")
.enable_all() .enable_all()
.build() .build()
.expect("Runtime"), .expect("Runtime");
);
let exit_bigtable_ledger_upload_service = Arc::new(AtomicBool::new(false)); let exit_bigtable_ledger_upload_service = Arc::new(AtomicBool::new(false));
@ -300,7 +301,7 @@ impl JsonRpcService {
info!("BigTable ledger storage initialized"); info!("BigTable ledger storage initialized");
let bigtable_ledger_upload_service = Arc::new(BigTableUploadService::new( let bigtable_ledger_upload_service = Arc::new(BigTableUploadService::new(
runtime.clone(), runtime.handle().clone(),
bigtable_ledger_storage.clone(), bigtable_ledger_storage.clone(),
blockstore.clone(), blockstore.clone(),
block_commitment_cache.clone(), block_commitment_cache.clone(),
@ -329,7 +330,7 @@ impl JsonRpcService {
health.clone(), health.clone(),
cluster_info.clone(), cluster_info.clone(),
genesis_hash, genesis_hash,
runtime, &runtime,
bigtable_ledger_storage, bigtable_ledger_storage,
optimistically_confirmed_bank, optimistically_confirmed_bank,
); );
@ -403,6 +404,7 @@ impl JsonRpcService {
.register_exit(Box::new(move || close_handle_.close())); .register_exit(Box::new(move || close_handle_.close()));
Self { Self {
thread_hdl, thread_hdl,
runtime,
#[cfg(test)] #[cfg(test)]
request_processor: test_request_processor, request_processor: test_request_processor,
close_handle: Some(close_handle), close_handle: Some(close_handle),
@ -416,6 +418,7 @@ impl JsonRpcService {
} }
pub fn join(self) -> thread::Result<()> { pub fn join(self) -> thread::Result<()> {
self.runtime.shutdown_background();
self.thread_hdl.join() self.thread_hdl.join()
} }
} }

View File

@ -35,7 +35,7 @@ solana-transaction-status = { path = "../transaction-status", version = "1.6.0"
solana-version = { path = "../version", version = "1.6.0" } solana-version = { path = "../version", version = "1.6.0" }
solana-vote-program = { path = "../programs/vote", version = "1.6.0" } solana-vote-program = { path = "../programs/vote", version = "1.6.0" }
tempfile = "3.1.0" tempfile = "3.1.0"
tokio = { version = "0.3", features = ["full"] } tokio = { version = "0.2.22", features = ["full"] }
[dev-dependencies] [dev-dependencies]
assert_cmd = "1.0" assert_cmd = "1.0"

View File

@ -378,7 +378,7 @@ impl BigTableSubCommand for App<'_, '_> {
} }
pub fn bigtable_process_command(ledger_path: &Path, matches: &ArgMatches<'_>) { pub fn bigtable_process_command(ledger_path: &Path, matches: &ArgMatches<'_>) {
let runtime = tokio::runtime::Runtime::new().unwrap(); let mut runtime = tokio::runtime::Runtime::new().unwrap();
let future = match matches.subcommand() { let future = match matches.subcommand() {
("upload", Some(arg_matches)) => { ("upload", Some(arg_matches)) => {

View File

@ -50,7 +50,7 @@ solana-storage-proto = { path = "../storage-proto", version = "1.6.0" }
solana-vote-program = { path = "../programs/vote", version = "1.6.0" } solana-vote-program = { path = "../programs/vote", version = "1.6.0" }
tempfile = "3.1.0" tempfile = "3.1.0"
thiserror = "1.0" thiserror = "1.0"
tokio = { version = "0.3", features = ["full"] } tokio = { version = "0.2.22", features = ["full"] }
trees = "0.2.1" trees = "0.2.1"
[dependencies.rocksdb] [dependencies.rocksdb]

View File

@ -11,6 +11,7 @@ use std::{
}, },
time::Duration, time::Duration,
}; };
use tokio::time::delay_for;
// Attempt to upload this many blocks in parallel // Attempt to upload this many blocks in parallel
const NUM_BLOCKS_TO_UPLOAD_IN_PARALLEL: usize = 32; const NUM_BLOCKS_TO_UPLOAD_IN_PARALLEL: usize = 32;
@ -80,7 +81,7 @@ pub async fn upload_confirmed_blocks(
Err(err) => { Err(err) => {
error!("get_confirmed_blocks for {} failed: {:?}", start_slot, err); error!("get_confirmed_blocks for {} failed: {:?}", start_slot, err);
// Consider exponential backoff... // Consider exponential backoff...
tokio::time::sleep(Duration::from_secs(2)).await; delay_for(Duration::from_secs(2)).await;
} }
} }
}; };