Skip to content

Commit 0fa285a

Browse files
committed
background_jobs: Remove unused UpdateCrateIndex job
This has been replaced by the two `SyncToGit/SparseIndex` jobs
1 parent 380931e commit 0fa285a

File tree

3 files changed

+1
-36
lines changed

3 files changed

+1
-36
lines changed

src/background_jobs.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ jobs! {
7777
SquashIndex,
7878
SyncToGitIndex(SyncToIndexJob),
7979
SyncToSparseIndex(SyncToIndexJob),
80-
UpdateCrateIndex(UpdateCrateIndexJob),
8180
UpdateDownloads,
8281
}
8382
}
@@ -170,10 +169,6 @@ impl Job {
170169
})
171170
}
172171

173-
pub fn update_crate_index(crate_name: String) -> Self {
174-
Self::UpdateCrateIndex(UpdateCrateIndexJob { crate_name })
175-
}
176-
177172
pub fn update_downloads() -> Self {
178173
Self::UpdateDownloads
179174
}
@@ -204,7 +199,6 @@ impl Job {
204199
}
205200
Job::DumpDb(args) => worker::perform_dump_db(env, args.database_url, args.target_name),
206201
Job::SquashIndex => worker::perform_index_squash(env),
207-
Job::UpdateCrateIndex(args) => worker::perform_index_sync_to_http(env, args.crate_name),
208202
Job::NormalizeIndex(args) => worker::perform_normalize_index(env, args),
209203
Job::RenderAndUploadReadme(args) => worker::perform_render_and_upload_readme(
210204
conn,

src/worker/git.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,6 @@ use std::fs::{self, File};
99
use std::io::{BufRead, BufReader, ErrorKind, Write};
1010
use std::process::Command;
1111

12-
#[instrument(skip(env))]
13-
pub fn perform_index_sync_to_http(
14-
env: &Environment,
15-
crate_name: String,
16-
) -> Result<(), PerformError> {
17-
info!("Syncing git index to HTTP-based index");
18-
19-
let repo = env.lock_index()?;
20-
let dst = repo.index_file(&crate_name);
21-
22-
let contents = match fs::read_to_string(dst) {
23-
Ok(contents) => Some(contents),
24-
Err(e) if e.kind() == ErrorKind::NotFound => None,
25-
Err(e) => return Err(e.into()),
26-
};
27-
28-
env.uploader
29-
.sync_index(env.http_client(), &crate_name, contents)?;
30-
31-
if let Some(cloudfront) = env.cloudfront() {
32-
let path = Repository::relative_index_file_for_url(&crate_name);
33-
info!(%path, "Invalidating index file on CloudFront");
34-
cloudfront.invalidate(env.http_client(), &path)?;
35-
}
36-
37-
Ok(())
38-
}
39-
4012
/// Regenerates or removes an index file for a single crate
4113
#[instrument(skip_all, fields(krate.name = ?krate))]
4214
pub fn sync_to_git_index(

src/worker/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ mod update_downloads;
1313
pub(crate) use daily_db_maintenance::perform_daily_db_maintenance;
1414
pub(crate) use dump_db::perform_dump_db;
1515
pub(crate) use git::{
16-
perform_index_squash, perform_index_sync_to_http, perform_normalize_index, sync_to_git_index,
17-
sync_to_sparse_index,
16+
perform_index_squash, perform_normalize_index, sync_to_git_index, sync_to_sparse_index,
1817
};
1918
pub(crate) use readmes::perform_render_and_upload_readme;
2019
pub(crate) use update_downloads::perform_update_downloads;

0 commit comments

Comments
 (0)