Skip to content

Commit

Permalink
Revert "delta-generator-client: add CDN_URL env to set the cdn to dow…
Browse files Browse the repository at this point in the history
…nload deltas from"

This reverts commit bb1d48b.
  • Loading branch information
barthalion committed May 23, 2024
1 parent 75af9e0 commit 9b623b9
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/bin/delta-generator-client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ gpg-verify-summary=false
struct Manager {
fs_pool: FsPool,
url: String,
cdn_url: Option<String>,
token: String,
client: Option<Addr<DeltaClient>>,
capacity: u32,
Expand Down Expand Up @@ -108,7 +107,6 @@ impl Manager {
let capacity = manager.capacity;
let repo = manager.repo.clone();
let url = manager.url.clone();
let cdn_url = manager.cdn_url.clone();
let token = manager.token.clone();
let fs_pool = manager.fs_pool.clone();
let (sink, stream) = framed.split();
Expand All @@ -119,7 +117,6 @@ impl Manager {
writer: SinkWrite::new(sink, ctx),
manager: addr,
url,
cdn_url,
token,
capacity,
repo,
Expand Down Expand Up @@ -161,7 +158,6 @@ struct DeltaClient {
writer: SinkWrite<SplitSink<Framed<awc::BoxedSocket, Codec>>>,
manager: Addr<Manager>,
url: String,
cdn_url: Option<String>,
token: String,
capacity: u32,
repo: PathBuf,
Expand Down Expand Up @@ -394,12 +390,6 @@ impl DeltaClient {
let path2 = self.repo.clone();
let delta2 = delta.clone();
let base_url = self.url.clone();
// if we have set a CDN_URL, let's use it for the download.
let cdn_url = if let Some(ref cdn_url) = self.cdn_url {
cdn_url.clone()
} else {
url
};
let token = self.token.clone();
let reponame = repo;
let fs_pool = self.fs_pool.clone();
Expand All @@ -411,7 +401,7 @@ impl DeltaClient {
.read()
.into_actor(self)
.then(move |guard, client, _ctx| {
pull_and_generate_delta_async(&path, &cdn_url, &delta)
pull_and_generate_delta_async(&path, &url, &delta)
.and_then(move |_| {
upload_delta(fs_pool, base_url, token, reponame, path2, delta2)
})
Expand Down Expand Up @@ -480,8 +470,6 @@ fn main() {

let token = env::var("REPO_TOKEN").expect("No token, set REPO_TOKEN in env or .env");
let url = env::var("MANAGER_URL").unwrap_or_else(|_| "http://127.0.0.1:8080".to_string());
// CDN_URL to download delta from. By default same as MANAGER_URL.
let cdn_url = env::var("CDN_URL").ok();
let capacity: u32 = env::var("CAPACITY")
.map(|s| s.parse().expect("Failed to parse $CAPACITY"))
.unwrap_or_else(|_| num_cpus::get() as u32);
Expand All @@ -498,7 +486,6 @@ fn main() {
let _addr = Manager {
fs_pool: FsPool::default(),
url,
cdn_url,
token,
client: None,
capacity,
Expand Down

0 comments on commit 9b623b9

Please sign in to comment.