@@ -268,13 +268,15 @@ struct ClosestIssue {
268268
269269#[ derive( Debug , Deserialize , Serialize ) ]
270270enum JobData {
271- IssueIndexation { issues_page : i32 } ,
271+ // FIXME: naming is a bit confusing, this means "repository issue indexation"
272+ IssueIndexation { next_url : String } ,
272273 EmbeddingsRegeneration { current_issue : i32 } ,
273274}
274275
275276#[ derive( Debug , sqlx:: Type ) ]
276277#[ sqlx( type_name = "job_type" , rename_all = "snake_case" ) ]
277278enum JobType {
279+ // FIXME: naming is a bit confusing, this means "repository issue indexation"
278280 IssueIndexation ,
279281 EmbeddingsRegeneration ,
280282}
@@ -576,11 +578,11 @@ async fn handle_webhooks(
576578 }
577579 } ;
578580 let from_issues_page =
579- job. as_ref ( ) . and_then ( |j| match j. data . 0 { JobData :: IssueIndexation { issues_page } => Some ( issues_page + 1 ) , _ => None } ) . unwrap_or ( 1 ) ;
581+ job. and_then ( |j| match j. data . 0 { JobData :: IssueIndexation { next_url } => Some ( next_url ) , _ => None } ) ;
580582 let issues = github_api. get_issues ( from_issues_page, repo_data. clone ( ) ) ;
581583 pin_mut ! ( issues) ;
582584 while let Some ( issue) = issues. next ( ) . await {
583- let ( issue, page ) = match issue {
585+ let ( issue, next_url ) = match issue {
584586 Ok ( issue) => issue,
585587 Err ( err) => {
586588 error ! ( err = err. to_string( ) , "error fetching next item from issues stream" ) ;
@@ -664,7 +666,7 @@ async fn handle_webhooks(
664666 error ! ( issue_number = issue. number, err = err. to_string( ) , "error inserting comments" ) ;
665667 }
666668 }
667- if let Some ( page ) = page {
669+ if let Some ( next_url ) = next_url {
668670 if let Err ( err) = sqlx:: query (
669671 r#"insert into jobs (data, job_type, repository_full_name)
670672 values ($1, $2, $3)
@@ -675,7 +677,7 @@ async fn handle_webhooks(
675677 updated_at = current_timestamp"# ,
676678 )
677679 . bind ( Json ( JobData :: IssueIndexation {
678- issues_page : page ,
680+ next_url ,
679681 } ) )
680682 . bind ( JobType :: IssueIndexation )
681683 . bind ( & repo_data. full_name )
0 commit comments