Skip to content

Commit 788296c

Browse files
committed
admin/render_og_images: Add --skip-invalidation option
This adds an option to explicitly skip CDN invalidations, defaulting to false, now that the initial backfill is done.
1 parent 8c8de36 commit 788296c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/bin/crates-admin/render_og_images.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ pub struct Opts {
2424
#[arg(long)]
2525
/// Offset to start enqueueing from (useful for resuming)
2626
offset: Option<i64>,
27+
28+
#[arg(long)]
29+
/// Skip CDN cache invalidation when generating OG images
30+
skip_invalidation: bool,
2731
}
2832

2933
pub async fn run(opts: Opts) -> Result<()> {
@@ -79,7 +83,13 @@ pub async fn run(opts: Opts) -> Result<()> {
7983
// Create batch of jobs
8084
let jobs = crate_names
8185
.into_iter()
82-
.map(GenerateOgImage::without_cdn_invalidation)
86+
.map(|crate_name| {
87+
if opts.skip_invalidation {
88+
GenerateOgImage::without_cdn_invalidation(crate_name)
89+
} else {
90+
GenerateOgImage::new(crate_name)
91+
}
92+
})
8393
.map(|job| {
8494
Ok((
8595
background_jobs::job_type.eq(GenerateOgImage::JOB_NAME),

0 commit comments

Comments
 (0)