mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-07-03 20:43:21 +00:00
client: backup writer: only borrow http client
Instead of taking ownership of the http client when starting a new BackupWriter instance, only borrow the client. This allows to reuse the http client to later reuse it to start also a BackupReader instance as required for backup runs with metadata based file change detection mode, where both must use the same http client. Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
parent
df5854986c
commit
fcea0794c8
@ -18,7 +18,7 @@ async fn upload_speed() -> Result<f64, Error> {
|
|||||||
let backup_time = proxmox_time::epoch_i64();
|
let backup_time = proxmox_time::epoch_i64();
|
||||||
|
|
||||||
let client = BackupWriter::start(
|
let client = BackupWriter::start(
|
||||||
client,
|
&client,
|
||||||
None,
|
None,
|
||||||
datastore,
|
datastore,
|
||||||
&BackupNamespace::root(),
|
&BackupNamespace::root(),
|
||||||
|
@ -78,7 +78,7 @@ impl BackupWriter {
|
|||||||
// FIXME: extract into (flattened) parameter struct?
|
// FIXME: extract into (flattened) parameter struct?
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub async fn start(
|
pub async fn start(
|
||||||
client: HttpClient,
|
client: &HttpClient,
|
||||||
crypt_config: Option<Arc<CryptConfig>>,
|
crypt_config: Option<Arc<CryptConfig>>,
|
||||||
datastore: &str,
|
datastore: &str,
|
||||||
ns: &BackupNamespace,
|
ns: &BackupNamespace,
|
||||||
|
@ -229,7 +229,7 @@ async fn test_upload_speed(
|
|||||||
|
|
||||||
log::debug!("Connecting to backup server");
|
log::debug!("Connecting to backup server");
|
||||||
let client = BackupWriter::start(
|
let client = BackupWriter::start(
|
||||||
client,
|
&client,
|
||||||
crypt_config.clone(),
|
crypt_config.clone(),
|
||||||
repo.store(),
|
repo.store(),
|
||||||
&BackupNamespace::root(),
|
&BackupNamespace::root(),
|
||||||
|
@ -834,7 +834,7 @@ async fn create_backup(
|
|||||||
|
|
||||||
let backup_time = backup_time_opt.unwrap_or_else(epoch_i64);
|
let backup_time = backup_time_opt.unwrap_or_else(epoch_i64);
|
||||||
|
|
||||||
let client = connect_rate_limited(&repo, rate_limit)?;
|
let http_client = connect_rate_limited(&repo, rate_limit)?;
|
||||||
record_repository(&repo);
|
record_repository(&repo);
|
||||||
|
|
||||||
let snapshot = BackupDir::from((backup_type, backup_id.to_owned(), backup_time));
|
let snapshot = BackupDir::from((backup_type, backup_id.to_owned(), backup_time));
|
||||||
@ -886,7 +886,7 @@ async fn create_backup(
|
|||||||
};
|
};
|
||||||
|
|
||||||
let client = BackupWriter::start(
|
let client = BackupWriter::start(
|
||||||
client,
|
&http_client,
|
||||||
crypt_config.clone(),
|
crypt_config.clone(),
|
||||||
repo.store(),
|
repo.store(),
|
||||||
&backup_ns,
|
&backup_ns,
|
||||||
|
Loading…
Reference in New Issue
Block a user