Skip to content

Commit

Permalink
fix(fetcher): basis file is opened in wrong mode
Browse files Browse the repository at this point in the history
  • Loading branch information
PhotonQuantum committed Feb 21, 2023
1 parent 4853592 commit 6a5b49b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rsync-fetcher/src/rsync/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::sync::Arc;

use eyre::Result;
use indicatif::ProgressBar;
use tokio::fs::File;
use tokio::fs::{File, OpenOptions};
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, BufReader};
use tokio::net::tcp::OwnedWriteHalf;
use tracing::{debug, info, warn};
Expand Down Expand Up @@ -131,7 +131,13 @@ impl Generator {
}
async fn download_basis_file(&self, blake2b_hash: &[u8; 20], path: &[u8]) -> Result<File> {
let basis_path = self.basis_dir.join(format!("{:x}", hash(path).as_hex()));
let mut basis_file = File::create(basis_path).await?;
let mut basis_file = OpenOptions::new()
.read(true)
.write(true)
.create(true)
.truncate(true)
.open(basis_path)
.await?;
let obj = self
.s3
.get_object()
Expand Down

0 comments on commit 6a5b49b

Please sign in to comment.