Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33308474
D5153.1768801839.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D5153.1768801839.diff
View Options
diff --git a/services/backup/blob_client/src/get_client.rs b/services/backup/blob_client/src/get_client.rs
--- a/services/backup/blob_client/src/get_client.rs
+++ b/services/backup/blob_client/src/get_client.rs
@@ -9,12 +9,12 @@
use crate::tools::{
c_char_pointer_to_string, check_error, report_error, string_to_c_char_pointer,
};
+use crate::RUNTIME;
use lazy_static::lazy_static;
use libc;
use libc::c_char;
use std::collections::HashMap;
use std::sync::Mutex;
-use tokio::runtime::Runtime;
use tokio::sync::mpsc;
use tokio::task::JoinHandle;
@@ -28,7 +28,6 @@
// if every client is able to allocate up to 4MB data at a time
static ref CLIENTS: Mutex<HashMap<String, ReadClient>> =
Mutex::new(HashMap::new());
- static ref RUNTIME: Runtime = Runtime::new().unwrap();
static ref ERROR_MESSAGES: Mutex<Vec<String>> =
Mutex::new(Vec::new());
}
diff --git a/services/backup/blob_client/src/lib.rs b/services/backup/blob_client/src/lib.rs
--- a/services/backup/blob_client/src/lib.rs
+++ b/services/backup/blob_client/src/lib.rs
@@ -3,6 +3,9 @@
mod put_client;
mod tools;
+use lazy_static::lazy_static;
+use tokio::runtime;
+
use put_client::{
put_client_blocking_read_cxx, put_client_initialize_cxx,
put_client_terminate_cxx, put_client_write_cxx,
@@ -12,6 +15,12 @@
get_client_blocking_read_cxx, get_client_initialize_cxx,
get_client_terminate_cxx,
};
+
+lazy_static! {
+ static ref RUNTIME: runtime::Runtime = runtime::Runtime::new()
+ .expect("Unable to create tokio runtime");
+}
+
#[cxx::bridge]
mod ffi {
extern "Rust" {
diff --git a/services/backup/blob_client/src/put_client.rs b/services/backup/blob_client/src/put_client.rs
--- a/services/backup/blob_client/src/put_client.rs
+++ b/services/backup/blob_client/src/put_client.rs
@@ -11,13 +11,13 @@
use crate::tools::{
c_char_pointer_to_string, check_error, report_error, string_to_c_char_pointer,
};
+use crate::RUNTIME;
use lazy_static::lazy_static;
use libc;
use libc::c_char;
use std::collections::HashMap;
use std::ffi::CStr;
use std::sync::Mutex;
-use tokio::runtime::Runtime;
use tokio::sync::mpsc;
use tokio::task::JoinHandle;
@@ -39,7 +39,6 @@
// if every client is able to allocate up to 4MB data at a time
static ref CLIENTS: Mutex<HashMap<String, BidiClient>> =
Mutex::new(HashMap::new());
- static ref RUNTIME: Runtime = Runtime::new().unwrap();
static ref ERROR_MESSAGES: Mutex<Vec<String>> =
Mutex::new(Vec::new());
}
@@ -133,7 +132,7 @@
Ok(maybe_response_message) => {
let mut result = false;
if let Some(response_message) = maybe_response_message {
- // warning: this will produce an error if there's more unread
+ // warning: this will produce an error if there's more unread
// responses than MPSC_CHANNEL_BUFFER_CAPACITY
// you should then use put_client_blocking_read_cxx in order
// to dequeue the responses in c++ and make room for more
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 5:50 AM (8 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5954651
Default Alt Text
D5153.1768801839.diff (2 KB)
Attached To
Mode
D5153: [Backup] Use only one tokio runtime
Attached
Detach File
Event Timeline
Log In to Comment