tosnativeclient 1.0.5__tar.gz → 1.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tosnativeclient might be problematic. Click here for more details.

@@ -1521,7 +1521,7 @@ dependencies = [
1521
1521
 
1522
1522
  [[package]]
1523
1523
  name = "tosnativeclient"
1524
- version = "1.0.5"
1524
+ version = "1.0.6"
1525
1525
  dependencies = [
1526
1526
  "arc-swap",
1527
1527
  "async-channel",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "tosnativeclient"
3
- version = "1.0.5"
3
+ version = "1.0.6"
4
4
  edition = "2021"
5
5
  publish = false
6
6
  authors = ["xiangshijian"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tosnativeclient
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -11,6 +11,7 @@ use std::sync::atomic::{AtomicI8, AtomicIsize, Ordering};
11
11
  use std::sync::Arc;
12
12
  use tokio::runtime::{Handle, Runtime};
13
13
  use tokio::sync::{Mutex, MutexGuard};
14
+ use tokio::task::JoinHandle;
14
15
  use tracing::log::{error, warn};
15
16
  use ve_tos_rust_sdk::asynchronous::object::ObjectAPI;
16
17
  use ve_tos_rust_sdk::error::TosError;
@@ -341,9 +342,9 @@ impl ObjectFetcher {
341
342
  return None;
342
343
  }
343
344
 
344
- let task = self.new_fetch_task(fc);
345
+ let mut task = self.new_fetch_task(fc);
345
346
  self.revise_next_request_offset_and_size(fc, task.size);
346
- task.async_fetch(self.client.clone(), runtime);
347
+ task.wait_async_fetch = Some(task.async_fetch(self.client.clone(), runtime));
347
348
  Some(task)
348
349
  }
349
350
 
@@ -512,6 +513,7 @@ impl ObjectFetcher {
512
513
  chunk_queue: Arc::new(ChunkQueue::new(self.calc_chunk_queue_size() as usize)),
513
514
  last_chunk: ChunkHolder::new(None),
514
515
  closed: self.closed.clone(),
516
+ wait_async_fetch: None,
515
517
  }
516
518
  }
517
519
 
@@ -537,6 +539,7 @@ impl ObjectFetcher {
537
539
  chunk_queue: Arc::new(ChunkQueue::new(chunks.len())),
538
540
  last_chunk: ChunkHolder { inner: None },
539
541
  closed: self.closed.clone(),
542
+ wait_async_fetch: None,
540
543
  };
541
544
 
542
545
  for chunk in chunks {
@@ -653,6 +656,7 @@ struct FetchTask {
653
656
  chunk_queue: Arc<ChunkQueue>,
654
657
  last_chunk: ChunkHolder,
655
658
  closed: Arc<AtomicI8>,
659
+ wait_async_fetch: Option<JoinHandle<()>>,
656
660
  }
657
661
 
658
662
  impl FetchTask {
@@ -666,12 +670,12 @@ impl FetchTask {
666
670
  self.start_offset + self.fetched_size.load(Ordering::Acquire)
667
671
  }
668
672
 
669
- fn async_fetch(&self, client: Arc<InnerTosClient>, runtime: Arc<Runtime>) {
673
+ fn async_fetch(&self, client: Arc<InnerTosClient>, runtime: Arc<Runtime>) -> JoinHandle<()> {
670
674
  let fetch_task_context = FetchTaskContext::new(self, client);
671
675
  runtime.spawn(async move {
672
676
  fetch_task_context.fetch_from_server().await;
673
677
  fetch_task_context.chunk_queue.close();
674
- });
678
+ })
675
679
  }
676
680
 
677
681
  async fn read(&mut self, length: isize) -> Option<Chunk> {
@@ -716,6 +720,9 @@ impl FetchTask {
716
720
  self.shared_prefetch_task.fetch_add(-1, Ordering::Release);
717
721
  self.pcontext.release_shared_prefetch_task();
718
722
  }
723
+ if let Some(wait_execute) = self.wait_async_fetch.take() {
724
+ let _ = wait_execute.await;
725
+ }
719
726
  }
720
727
  }
721
728