@@ -9,8 +9,8 @@ use tracing::{info, warn};
99
1010#[ derive( clap:: Parser , Debug ) ]
1111#[ command(
12- name = "backfill -og-images" ,
13- about = "Enqueue OG image generation jobs for existing crates"
12+ name = "render -og-images" ,
13+ about = "Enqueue OG image generation jobs for crates"
1414) ]
1515pub struct Opts {
1616 #[ arg( long, default_value = "1000" ) ]
@@ -24,12 +24,16 @@ 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
2933pub async fn run ( opts : Opts ) -> Result < ( ) > {
3034 let mut conn = db:: oneoff_connection ( ) . await ?;
3135
32- info ! ( "Starting OG image backfill with options: {opts:?}" ) ;
36+ info ! ( "Starting OG image rendering with options: {opts:?}" ) ;
3337
3438 // Helper function to build query
3539 let build_query = |offset : i64 | {
@@ -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